Re:Our SQL interview questions
by jacques_chester on Tuesday May 28, 2013 @09:00AM
(#5779673)
The empty department remark is the clue. They want all departments; if it's an empty department they still want to see that it's an empty department.
An inner join will hide that row because there's no equality between a set (departments) and an empty set (employees in that dept, of which there are none). A correctly structured outer join will.
>List all departments along with the number of people there (tricky - people often do an "inner join" leaving out empty departments)
inner join seems the non obvious way to do it really IMO.