w3resource
SQL exercises

SQL exercises on hospital Database: Find the names of all the physicians performed a medical procedure but they are not ceritifed to perform

SQL hospital Database: Exercise-31 with Solution

31. Write a SQL query to obtain the names of all the physicians performed a medical procedure but they are not ceritifed to perform.

Sample table: physician


Sample table: undergoes


Sample table: trained_in


Sample Solution:

SELECT name AS "Physician"
FROM physician
WHERE employeeid IN
    ( SELECT undergoes.physician
     FROM undergoes
     LEFT JOIN trained_In ON undergoes.physician=trained_in.physician
     AND undergoes.procedure=trained_in.treatment
     WHERE treatment IS NULL );

Sample Output:

    Physician
------------------
 Christopher Turk
(1 row)

Practice Online


E R Diagram of Hospital Database:

E R Diagram: SQL Hospital Database.

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

What is the difficulty level of this exercise?



New Content: Composer: Dependency manager for PHP, R Programming