← Back to Aggregates & GROUP BY
Question 16
Departments With Ten or More Completed Grades
Departments With Ten or More Completed Grades
For each department, look only at enrollments withstatus = 'completed'in that department's courses. Returndepartment(thename),completed(how many such enrollments) andavg_grade(their averagegrade, rounded to 2 decimal places). Keep only departments with at least 10 completed enrollments, sorted byavg_gradedescending. The status test happens before grouping; the size test happens after.
Expected result:
+------------------+-----------+-----------+ | department | completed | avg_grade | +------------------+-----------+-----------+ | English | 10 | 81.6 | | Mathematics | 15 | 78.33 | | Computer Science | 13 | 78 | +------------------+-----------+-----------+ 3 rows
Hints4 available
Sign in to use hintsTopics:
Aggregates & GROUP BY
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (sel, ins, desc)
Results
Run your SQL to see every statement's output here, then how it compares with the expected answer.
Not sure what is in a table? SHOW TABLES lists them and DESCRIBE students shows the columns — or open the database browser on the left.