Count SUM MAX MIN AVG
Count SUM MAX MIN AVG
●
COUNT()
●
SUM()
●
MAX()
●
MIN()
●
AVG()
COUNT()
COUNT()
SELECT COUNT(*)
FROM employees
WHERE experience < 5;
* COUNT(*)
COUNT(column) NULL
SUM()
SUM()
SELECT SUM(salary)
FROM salary_disbursement;
AVG()
AVG()
SELECT AVG(salary)
salary FROM employees
WHERE experience < 5;
1 of 3 6/22/2020, 7:52 PM
Firefox https://www.codecademy.com/learn/learn-sql/modules/learn-sql-aggregat...
ROUND()
ROUND()
SELECT year,
ROUND(AVG(rating), 2)
FROM movies
WHERE year = 2015;
GROUP BY
GROUP BY
SELECT rating,
COUNT(*)
GROUP BY FROM movies
FROM WHERE GROUP BY rating;
ORDER BY LIMIT
GROUP BY ORDER BY
SELECT COUNT(*) AS 'total_movies',
SELECT rating
FROM movies
GROUP BY 2
●
GROUP BY 2 rating ORDER BY 1;
●
ORDER BY 1 total_movies
HAVING
HAVING
SELECT year,
GROUP BY
COUNT(*)
HAVING
FROM movies
GROUP BY year
HAVING COUNT(*) > 5;
MAX()
MAX()
SELECT MAX(amount)
FROM transactions;
amount
2 of 3 6/22/2020, 7:52 PM
Firefox https://www.codecademy.com/learn/learn-sql/modules/learn-sql-aggregat...
MIN()
MIN()
SELECT MIN(amount)
amount FROM transactions;
transactions
3 of 3 6/22/2020, 7:52 PM