totn SQLite Functions

SQLite: round Function

This SQLite tutorial explains how to use the SQLite round function with syntax and examples.

Description

The SQLite round function returns a number rounded to a certain number of decimal places.

Syntax

The syntax for the round function in SQLite is:

round( number, [ decimal_places ] )

Parameters or Arguments

number
The number to round.
decimal_places
The number of decimal places rounded to. If this parameter is omitted, the round function will round the number to 0 decimal places.

Applies To

The round function can be used in the following versions of SQLite:

  • SQLite 3.8.6, SQLite 3.8.x, SQLite 3.7.x, SQLite 3.6.x

Example

Let's look at some SQLite round function examples and explore how to use the round function in SQLite.

For example:

sqlite> SELECT round(835.526);
Result:  836.0

sqlite> SELECT round(835.526, 0);
Result:  836.0

sqlite> SELECT round(835.526, 1);
Result:  835.5

sqlite> SELECT round(835.526, 2);
Result:  835.53

sqlite> SELECT round(835.5269, 3);
Result:  835.527