Your question is Classes Per Department SQL. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Taulia University needs a department-level view of its internal learning catalog. Write a PostgreSQL query that joins departments to classes and reports how many classes belong to each department.
class_id, so departments without classes return 0 rather than NULL.department_name and the count as class_count.class_count descending, then department_name ascending for deterministic results.| Column | Type | Description |
|---|---|---|
| department_idPK | INT | Unique department identifier |
| department_name | VARCHAR(100) | Department name |
| Column | Type | Description |
|---|---|---|
| class_idPK | INT | Unique class identifier |
| department_id | INT | Owning department identifier |
| class_name | VARCHAR(150) | Taulia University class name |
| instructor_name | VARCHAR(100) | Class instructor |