SQL exercises

SQL exercises on hospital Database: Count the number available rooms

SQL hospital Database: Exercise-6 with Solution

6. Write a query in SQL to count the number available rooms.

Sample table: room

Sample Solution:

SELECT count(*) "Number of available rooms"
FROM room
WHERE unavailable='false';

Sample Output:

 Number of available rooms
(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 find the floor and block where the room number 212 belongs to.
Next: Write a query in SQL to count the number of unavailable rooms.

What is the difficulty level of this exercise?

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