Skip to main content

Categories: Math

FLOOR

Returns the nearest equal or smaller value of the input expression. FLOAT and DOUBLE inputs keep their numeric type, while DECIMAL inputs return a DECIMAL with scale 0 and a precision that may increase when needed to represent the rounded whole-number result. Returns NULL if the input is NULL.

Syntax​

FLOOR(numeric_expression NUMERIC) → NUMERIC​

  • numeric_expression: The number (DOUBLE, FLOAT, INTEGER, DECIMAL) for which you want to compute the floor.

Examples

FLOOR example
SELECT FLOOR(0)
-- 0
FLOOR example
SELECT FLOOR(45.76)
-- 45
FLOOR example
SELECT FLOOR(-1.3)
-- -2
Calculate the floor of a FLOAT value
SELECT FLOOR(CAST(3.14 AS FLOAT))
-- 3.0