PostgreSQL/Math Functions/floor

Материал из SQL эксперт
Перейти к: навигация, поиск

floor(dp or numeric) largest integer not greater than argument

postgres=# -- floor(dp or numeric) largest integer not greater than argument
postgres=#
postgres=# select floor(-42.8);
 floor
-------
   -43
(1 row)
postgres=#
postgres=#



floor(x): Returns the largest whole integer not greater than x (rounds down)

postgres=#
postgres=#
postgres=# -- floor(x): Returns the largest whole integer not greater than x (rounds down)
postgres=# SELECT floor(1.0) AS one,
postgres-#        floor(1.1) AS "one point one",
postgres-#        floor(1.8) AS "one point eight";
 one | one point one | one point eight
-----+---------------+-----------------
   1 |             1 |               1
(1 row)
postgres=#