Introduction
Function AVG
24. ROUND and AVG
Functions SUM, MAX, MIN
Revision

Instruction

Okay. Finally, we can use ROUND with AVG to get a nicer look of our results:

SELECT ROUND(AVG(price),2)
FROM project;

The above query will round the average price to two decimal places. Of course, you can also use AVG without the second argument: ROUND(AVG(price)) to get rounding to integer values.

Exercise

For each client, show the id and find the average price for all their projects rounded to integer values.

Stuck? Here's a hint!

Use ROUND(AVG(price)) and group by the client id.

Console

Code editor

Result

TableConsole