AVG gives the average of a column
Starting table: menu_items
| name | price |
|---|---|
| Espresso | 3.5 |
| Latte | 4.75 |
| Cold brew | 4.25 |
| Cookie | 4.5 |
AVG adds up a column of numbers and divides by how many values there were — the average, worked out for you. It also turns many rows into one answer, so the result is a single number. Pair it with AS to give that number a clear heading.
A tiny example
In plain English: Tell me the average price of all items on the menu.
SELECT AVG(price) AS average_price
FROM menu_items;Query result
| average_price |
|---|
| 4.25 |
The four menu prices total 17.00; 17.00 ÷ 4 gives an average of 4.25.
Related SQL lessons
Practice AVG step by step
The Foundations Track has beginner puzzles built around this idea. Tap tiles, see real results. No terminal, no setup.
practice this in the courseReady for a break?
A fresh, bite-sized SQL puzzle waits every morning. Tap tiles, see real results. No terminal, no setup, no timers.
Try today's free SQL puzzle