The SQLite ROUND() function returns a floating-point value that represents value rounded to a specified length or precision.
Syntax #
ROUND(value,precision)Arguments #
The ROUND() function accepts two arguments.
value
The value is the floating-point value or an expression that evaluates to a floating-point value.
precision
The precision is a positive integer. The value is rounded to its closest representation, not towards zero.
If either value or precision is NULL, the ROUND() function returns NULL. If you omit the precision argument, it is assumed to be zero. This will result in a whole number although the result is still a floating-point value.
Return Type #
RealExamples #
The following statement uses the ROUND() function to round a floating-point value to 2 decimals:
SELECT ROUND(1929.236, 2);ROUND(1929.236,2)
-----------------
1929.24The following statement rounds the number 1929.236 to a value with 1 decimal point.
SELECT ROUND(1929.236, 1);ROUND(1929.236, 1)
------------------
1929.2The following statement uses the ROUND() function without specifying the precision argument.
SELECT ROUND(1929.236);ROUND(1929.236)
---------------
1929This example uses the ROUND() function to round the number 0.5:
SELECT ROUND(0.5);The output is:
ROUND(0.5)
----------
1Thank you for your feedback!