# Aggregate Functions

Learn powerful functions for performing complex database operations with ease.

Start## Key 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`

column`2`

(`rating`

)`ORDER BY`

column`1`

(`total_movies`

)

- 1We’ve learned how to write queries to retrieve information from the database. Now, we are going to learn how to perform calculations using SQL. Calculations performed on multiple rows of a table a…
- 7Oftentimes, we will want to calculate an aggregate for data with certain characteristics. For instance, we might want to know the mean IMDb ratings for all movies each year. We could calculate ea…
- 8Sometimes, we want to GROUP BY a calculation done on a column. For instance, we might want to know how many movies have IMDb ratings that round to 1, 2, 3, 4, 5. We could do this using the follow…

## 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