🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: SQL Interview Queries: all 10 questions

Quiz: SQL Interview Queries · Question 2 of 10

After departments LEFT JOIN employees, which gives 0 (not 1) for a department with no employees?

After departments LEFT JOIN employees, which gives 0 (not 1) for a department with no employees?

  1. A.COUNT(*)
  2. B.COUNT(e.emp_id)
  3. C.SUM(1)
  4. D.COUNT(d.dept_id)
Answer & explanation

Correct answer: COUNT(e.emp_id)

The unmatched row has NULL in e.emp_id, and COUNT(column) skips NULLs.

Can you get the rest right without peeking?

Take the timed Quiz: SQL Interview Queries quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →