CJCoding With Joseph
15free / daySign inCreate account

Instructors Who Do Not Head a Department

List the seven instructors who are not the head of any department. Return first_name and last_name, sorted by last_name. Business has no head, so head_instructor_id is NULL there, and a naive NOT IN would return no rows at all: make the subquery leave that NULL out.

Expected result:

+------------+-----------+
| first_name | last_name |
+------------+-----------+
| Mei        | Chen      |
| Olivia     | Grant     |
| Marcus     | Lindqvist |
| Priya      | Natarajan |
| Tomasz     | Nowak     |
| Daniel     | Reyes     |
| Yuki       | Tanaka    |
+------------+-----------+
7 rows
Hints3 available
Topics:
Subqueries
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (sel, ins, desc)

Results

Run your SQL to see every statement's output here, then how it compares with the expected answer.

Not sure what is in a table? SHOW TABLES lists them and DESCRIBE students shows the columns — or open the database browser on the left.