Departments With Ten or More Completed Grades
hardQuestion 16For each department, look only at enrollments with status = 'completed' in that department's courses. Return department (the name), completed (how many such enrollments) and avg_grade (their average grade, rounded to 2 decimal places). Keep only departments with at least 10 completed enrollments, sorted by avg_grade descending. 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 under the question.