Aggregating Academic and Administrative Metrics Using GROUP BY and HAVING
In education administration, it is often necessary to summarize data to understand trends and performance. The GROUP BY clause allows you to aggregate data, while the HAVING clause lets you filter aggregated results.
GROUP BY is used to group rows based on a column, such as program, course, or instructor. Aggregate functions like COUNT(), SUM(), and AVG() are then applied to each group.
HAVING is used after aggregation to filter groups based on conditions, such as identifying sections with high enrollment or instructors with heavy teaching loads.
Common uses include:β’ Counting students per programβ’ Measuring average gradesβ’ Identifying sections with high enrollmentβ’ Filtering groups based on thresholds
The Basic Pattern
SELECT column_name, COUNT(*) AS total
FROM table_name
GROUP BY column_name
HAVING condition;
Examples
Example 1 β Count Students per Program (Only Programs with More Than 1 Student)
Example 2 β Average Score per Enrollment (Only High Averages)
Example 3 β Sections with 2 or More Enrollments
Practice Tasks (Your Turn!)
Task 1
Find terms that have more than 1 section.
Task 2
Find instructors who teach more than 1 section.
Task 3
Find programs with more than 1 active student.
Click a task from Practice Tasks to begin.

