Aggregate Functions
Learn powerful functions for performing complex database operations with ease.
StartKey Concepts
Review core concepts you need to learn to master this subject
Column References
SUM()
Aggregate Function
MAX()
Aggregate Function
COUNT()
Aggregate Function
GROUP BY
Clause
MIN()
Aggregate Function
AVG()
Aggregate Function
HAVING
Clause
Column References
Column References
SELECT COUNT(*) AS 'total_movies',
rating
FROM movies
GROUP BY 2
ORDER BY 1;
The GROUP BY
and ORDER BY
clauses can reference the selected columns by number in which they appear in the SELECT
statement. The example query will count the number of movies per rating, and will:
GROUP BY
column2
(rating
)ORDER BY
column1
(total_movies
)
What you'll create
Portfolio projects that showcase your new skills
Trends in Startups
In this next Pro project, we're going to practice aggregate functions in SQL so you can hone your skills and feel confident taking them to the real world. Using these functions will combine row values together and return a single result. What's next? It's your first day as a TechCrunch reporter and you need SQL! You got this!
How to Hack Hacker News
Use the SQL commands you have just learned to dig through Hacker News posts data. Thank you Hacker News for the data!
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory