SQL Exercise: List the nurses who are yet to be registered
SQL hospital Database: Exercise-1 with Solution
1. From the following table, write a SQL query to find out which nurses have not yet been registered. Return all the fields of nurse table.
Sample table: nurse
Sample Solution:
-- Selecting all columns from the 'nurse' table where the 'registered' column value is 'false'
SELECT *
FROM nurse
WHERE registered = 'false';
Sample Output:
employeeid | name | position | registered | ssn ------------+--------------+----------+------------+----------- 103 | Paul Flowers | Nurse | f | 333333330 (1 row)
Explanation:
The given query in SQL that retrieves all rows from the nurse table where the value of the registered column is 'false'.
The WHERE clause filters the results and returns only the rows where the value of the registered column is 'false'.
Pictorial presentation:
Relational Algebra Expression:
Relational Algebra Tree:
Practice Online
E R Diagram of Hospital Database:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous SQL Exercise: SQL Hospital Database - Exercises, Practice, Solution
Next SQL Exercise: Find the nurse who are the head of their department.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics