Skip to main content

FLOOR

Functions › Number

Rounds a number down to the whole number below it.

Syntax​

FLOOR( <number> )

Arguments​

ArgumentDescription
<number>A number, or text that reads as a number.

Returns​

An integer argument comes back unchanged, as an integer. Any other argument returns a float with no fraction (3.0). NULL when <number> is NULL. Text that does not read as a number fails the query.

Usage notes​

  • Down means toward negative infinity: FLOOR(-3.2) is -4. Use TRUNC to move toward zero.
  • Runs after the rows are read; it is not pushed to the data store.

Examples​

Group orders into price bands of 100:

SELECT FLOOR(o.total / 100) * 100 AS band, COUNT(*) AS orders
FROM Order o
GROUP BY FLOOR(o.total / 100) * 100
ORDER BY band
bandorders
034
10021
2009

See also​

CEIL · TRUNC · ROUND