| Function | Description | Example |
|---|---|---|
| COUNT() | Counts total number of rows or non-NULL values | SELECT COUNT(*) FROM students; |
| SUM() | Calculates total sum of a numeric column | SELECT SUM(salary) FROM employees; |
| AVG() | Finds average value of a column | SELECT AVG(marks) FROM students; |
| MAX() | Returns the highest value | SELECT MAX(marks) FROM students; |
| MIN() | Returns the lowest value | SELECT MIN(marks) FROM students; |
| COUNT(DISTINCT) | Counts unique values in a column | SELECT COUNT(DISTINCT department) FROM employees; |
| GROUP_CONCAT() (MySQL) | Combines multiple values into one string | SELECT GROUP_CONCAT(name) FROM students; |
| STRING_AGG() (PostgreSQL/SQL Server) | Concatenates values with separator | SELECT STRING_AGG(name, ', ') FROM students; |
| STDDEV() | Calculates standard deviation | SELECT STDDEV(salary) FROM employees; |
| VARIANCE() | Calculates variance of values | SELECT VARIANCE(salary) FROM employees; |
Lab Assignment/Tutorial
Aggregate Functions
You don’t have access to this lesson
Please register or sign in to access the course content.
