w3resource
SQL exercises

SQL exercises on hospital Database: Find the floor and block where the room number 212 belongs to

SQL hospital Database: Exercise-5 with Solution

5. Write a query in SQL to find the floor and block where the room number 212 belongs to.

Sample table: room


Sample Solution:

SELECT blockfloor AS "Floor",
       blockcode AS "Block"
FROM room
WHERE roomnumber=212;

Sample Output:

 Floor | Block
-------+-------
     2 |     2
(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.

Previous: Write a query in SQL to count the number of patients who booked an appointment with at least one physician.
Next: Write a query in SQL to count the number available rooms.

What is the difficulty level of this exercise?



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