🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: ER to Tables: all 15 questions

Quiz: ER to Tables · Question 14 of 15

In the phone-count query, why is COUNT(p.phone) used after the LEFT JOIN instead of COUNT()?

In the phone-count query, why is COUNT(p.phone) used after the LEFT JOIN instead of COUNT(*)?

  1. A.COUNT(*) is not allowed with GROUP BY
  2. B.For a student with no phones, COUNT(*) would count the NULL-filled row as 1; COUNT(p.phone) gives 0
  3. C.COUNT(p.phone) is faster
  4. D.They always give the same answer
Answer & explanation

Correct answer: For a student with no phones, COUNT(*) would count the NULL-filled row as 1; COUNT(p.phone) gives 0

COUNT(column) skips NULLs, so empty groups correctly show 0.

Can you get the rest right without peeking?

Take the timed Quiz: ER to Tables quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →