ROUND() Function

Hi there,
In exercise 9 in the aggregate-functions lesson the following code is used:

SELECT price,
ROUND(AVG(downloads)), count(*)
FROM fake_apps
GROUP BY price
HAVING COUNT(name) > 10;

My question is: The round function looks to me like it is only using one argument and no integer value. Does the ROUND() function automatically round to 0 if not integer is passed? The count clause afterwards is not in the brackets so I don’t see how that would work…

Thanks in advance to anyone who can help meh

1 Like

@jude6,

Welcome to the forums!

Yes, that is correct. When you don’t specify the number of digits to round to (to the right of the decimal), it defaults to 0. Here is a link to the documentation:
https://www.sqlite.org/lang_corefunc.html#round

1 Like

@jude6
ROUND() takes zero decimal places by default. Else you should specify the number of decimals you want.
e.g.
number = 4.182764747
ROUND(number) will return 4
but
ROUND(number, 2) will return 4.18
You get it? :100: