PostgreSQL/Math Functions/ceil

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

ceil(1.1), ceil(1.5)

   <source lang="sql">

postgres=# select ceil(1.1), ceil(1.5);

ceil | ceil

+------
   2 |    2

(1 row) postgres=#

      </source>
   
  


ceil(dp or numeric) smallest integer not less than argument

   <source lang="sql">

postgres=# postgres=# -- ceil(dp or numeric) smallest integer not less than argument postgres=# postgres=# select ceil(-42.8);

ceil

 -42

(1 row) postgres=#

      </source>
   
  


ceiling(dp or numeric) smallest integer not less than argument (alias for ceil)

   <source lang="sql">

postgres=# -- ceiling(dp or numeric) smallest integer not less than argument (alias for ceil) postgres=# postgres=# select ceiling(-95.3);

ceiling

    -95

(1 row) postgres=#

      </source>
   
  


ceil(x): Returns the smallest whole integer not less than argument (rounds up)

   <source lang="sql">

postgres=# -- ceil(x): Returns the smallest whole integer not less than argument (rounds up) postgres=# SELECT ceil(1.0);

ceil

   1

(1 row) postgres=#

      </source>