ROUND tidies up a number
Starting table: menu_items
| name | price |
|---|---|
| Espresso | 3.5 |
| Latte | 4.75 |
| Cold brew | 4.25 |
| Cookie | 4.6 |
ROUND takes a number and how many decimal places you want, and returns the rounded value. Averages often show up with a long tail of decimals, so ROUND tidies the display. It only changes what you see in the result — the numbers stored in the table stay exactly as they were.
A tiny example
In plain English: Tell me the average menu price, rounded to two decimal places.
SELECT ROUND(AVG(price), 2) AS average_price
FROM menu_items;Query result
| average_price |
|---|
| 4.28 |
The four prices total 17.10. Their average is 4.275; ROUND rounds it to two decimal places: 4.28.
Related SQL lessons
Ready 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