Write a SQL query that finds all departments that have no employees,
ordered by department name.
Tables
departments: id, nameemployees: id, name, dept_id
| dept | name |
|---|---|
| 1 | Engineering |
| 2 | Marketing |
| 3 | Legal |
| 4 | Sales |
Employees exist in Engineering (1), Marketing (2) and Sales (4) — but not Legal (3).
Expected output (column: department_name)
LegalSQLite output format — rows are pipe-separated (
|) with no column headers.Example:
SELECT id, name FROM users WHERE id = 1→1|Alice
Hint — use a
LEFT JOINand check forIS NULLon the employee side.
Sample tests