Does the ROUND() function round up?


#1

Question

Does the ROUND() function round up?

Answer

When using the ROUND() function, you can provide a second argument, which is the precision, or number of decimal places to round the number on.

In SQLite, rounding is done by rounding up if the next decimal value is 5, and rounds down if the value is less than 5.

For example,

/* This will result in 4.0 */
SELECT ROUND(3.5, 0);

/* This will result in 6.4 */
SELECT ROUND(6.42, 1);

/* This will result in 6.0 */
SELECT ROUND(6.42, 0);

#2

porqué esta sintaxis es correcta? ROUND(avg(downloads)), no necesitaría el segundo valor correspondiente a redondeo?