Departments with nobody in them

SQLMedium10 min

Your task

Find the departments that have no employees. Return name, ordered alphabetically.

The trap: an inner join can never show you a row that exists on only one side.

Tables

department
idINTEGERnameTEXT
1Engineering
2Sales
3Design
4Research
employee
idINTEGERnameTEXTsalaryINTEGERdepartment_idINTEGERmanager_idINTEGERhired_onTEXT
1Ada1800001NULL2021-03-01
2Grace165000112022-06-15
3Linus140000112023-01-09
4Mel1200002NULL2020-11-20
5Kay120000242023-04-02
6IvanNULL242024-02-17
More rows not shown