Loading problem...
A university analytics platform stores enrollment data in two tables:
Return a summary row for every department showing how many students are currently enrolled.
Output rules:
Supported submission formats:
Student:
| student_id | student_name | gender | dept_id |
|------------|--------------|--------|---------|
| 1 | Nora | F | 10 |
| 2 | Ivan | M | 10 |
| 3 | Leena | F | 11 |
Department:
| dept_id | dept_name |
|---------|-------------|
| 10 | Engineering |
| 11 | History |
| 12 | Law |[{"dept_name":"Engineering","student_number":2},{"dept_name":"History","student_number":1},{"dept_name":"Law","student_number":0}]Law has no students but still appears with count 0 due to left-join semantics.
Student:
| student_id | student_name | gender | dept_id |
|------------|--------------|--------|---------|
| 7 | Omar | M | 2 |
| 8 | Pia | F | 1 |
| 9 | Ruth | F | 2 |
| 10 | Sam | M | 1 |
Department:
| dept_id | dept_name |
|---------|------------|
| 1 | Analytics |
| 2 | Design |
| 3 | Finance |[{"dept_name":"Analytics","student_number":2},{"dept_name":"Design","student_number":2},{"dept_name":"Finance","student_number":0}]Analytics and Design tie at 2, so alphabetical order breaks the tie.
Student:
(empty)
Department:
| dept_id | dept_name |
|---------|--------------|
| 20 | Bioinformatics |
| 21 | Materials |[{"dept_name":"Bioinformatics","student_number":0},{"dept_name":"Materials","student_number":0}]When Student has no rows, every department count is 0.
Constraints