ROUND

From SQLZoo
Language: Project:Language policy English  • 日本語
Compatibility
ROUND(f,p)
EngineOKAlternative
ingresYes
mysqlYes
oracleYes
postgresYes
sqlserverYes

ROUND(f,p) returns f rounded to p decimal places.

The number of decimal places may be negative, this will round to the nearest 10 (when p is -1) or 100 (when p is -2) or 1000 (when p is -3) etc..

ROUND(7253.86, 0) -> 7254
ROUND(7253.86, 1) -> 7253.9
ROUND(7253.86,-3) -> 7000

In this example we calculate the population in millions to one decimial place.

SELECTname,
ROUND(population/1000000,1)
FROMbbc

See also

Kaleidoscope - get a kaleidoscope view using your phone/laptop camera
  • Served by: noddy at 2026年07月05日T12:43