SQL exercises on hospital Database: Find the nurses and the block where they are booked for attending the patients on call
SQL hospital Database: Exercise-29 with Solution
29. Write a query in SQL to obtain the nurses and the block where they are booked for attending the patients on call.
Sample table: nurse
Sample table: on_call
SELECT n.name AS "Nurse", o.blockcode AS "Block" FROM nurse n JOIN on_call o ON o.nurse=n.employeeid;
Nurse | Block -----------------+------- Carla Espinosa | 1 Carla Espinosa | 2 Laverne Roberts | 3 Paul Flowers | 1 Paul Flowers | 2 Paul Flowers | 3 (6 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?