FLOOR

From SQLZoo
Jump to navigation Jump to search
Compatibility
FLOOR(f)
EngineOKAlternative
ingresYes
mysqlYes
oracleYes
postgresYes
sqlserverYes

FLOOR

FLOOR(f) returns the integer value of f

FLOOR(f) give the integer that is equal to, or just less than f. FLOOR always rounds down.

  FLOOR(2.7) ->  2
  FLOOR(-2.7) -> -3

In this example we calculate the population in millions.

SELECT name,
       FLOOR(population/1000000)
  FROM bbc

See also

Language:Project:Language policy English  • Deutsch
DataWars, Data Science Practice Projects - LogoDataWars: Practice Data Science/Analysis with +100 Real Life Projects