Aggregate functions perform calculations on multiple rows and return a single value.
SELECT COUNT(*) FROM employees;SELECT SUM(salary) FROM employees;SELECT AVG(salary) FROM employees;SELECT MIN(salary), MAX(salary) FROM employees;SELECT COUNT(*)
FROM employees
WHERE department = 'Sales';SELECT department, AVG(salary)
FROM employees
GROUP BY department;SELECT department,
COUNT(*) AS total,
AVG(salary) AS avg_salary
FROM employees
GROUP BY department;SELECT department,
COUNT(*) AS total_employees,
SUM(salary) AS total_salary,
AVG(salary) AS avg_salary
FROM employees
GROUP BY department;Calculate total, average, and count for a table using aggregate functions.
SELECT
-- add COUNT, SUM, AVG
FROM employees;Ask the AI if you need help understanding or want to dive deeper in any topic