SQL exercises on hospital Database: Find the names of all the nurses who have ever been on call for room 122
SQL hospital Database: Exercise-35 with Solution
35. Write a query in SQL to obtain the names of all the nurses who have ever been on call for room 122.
Sample table: nurse
Sample table: on_call
Sample table: room
SELECT n.name FROM nurse n WHERE employeeid IN ( SELECT oc.nurse FROM on_call oc, room r WHERE oc.blockfloor = r.blockfloor AND oc.blockcode = r.blockcode AND r.roomnumber = 122 );
name ----------------- Laverne Roberts Paul Flowers (2 rows)
E R Diagram of Hospital Database:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
What is the difficulty level of this exercise?