Sql Aggregates — Free Sql Tutorial
Learn Sql Aggregates in Sql with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.
TL;DR: Learn Sql Aggregates in Sql with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.
Written & reviewed by the Syllab.in Academic Team (CBSE/NCERT subject experts) · Updated
Sql Aggregates in Sql
Aggregate functions perform calculations on a set of rows and return a single value. Key functions: COUNT() (count rows), SUM() (total), AVG() (average), MAX() (highest), MIN() (lowest).
GROUP BY divides rows into groups based on column values, then applies the aggregate function to each group. For example: average marks per class, count of students per city.
HAVING filters groups (like WHERE filters rows). Use HAVING to filter on aggregate results: HAVING AVG(marks) > 85.
Sql Aggregates — Syntax
SELECT COUNT(*) FROM students; SELECT AVG(marks) FROM students; SELECT MAX(marks), MIN(marks) FROM students; SELECT class, AVG(marks) FROM students GROUP BY class HAVING AVG(marks) > 80;
Learn Sql Aggregates step by step with Syllab's free interactive Sql tutorial — runnable code examples, practice exercises and instant AI feedback, all free with no signup. Explore the full Sql course →