intermediateSQL Query & Schema Design20 of 469
Count employees department-wise (SQL)
Tests whether you reach for GROUP BY on department_id with COUNT(*), and whether you remember to LEFT JOIN against the departments table so departments with zero employees aren't silently dropped.
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response