SQL FLOOR

The mirror of CEIL — always rounds DOWN to the nearest whole number, regardless of how large the decimal remainder is.

What & Why

FLOOR(n) always rounds down to the previous whole number. Common use: computing "how many complete units fit" — 4583.99 months of runway means only 4583 complete months have actually passed.

See How It Works

BUSINESS QUESTION

Product wants completed full rating points after a calculated adjustment.

iduser_idfeature_idratingnps_scorecommentcreated_at
1101159Clear and useful2024-01-25 12:15:00+00
210224NULLExport worked well2024-02-20 15:40:00+00
3103147Helpful setup flow2024-03-18 09:05:00+00
410433NULLNeeds clearer timing2024-04-08 17:30:00+00
EXAMPLE QUERY
SELECT
  id AS feedback_id,
  rating,
  FLOOR(rating * 0.9) AS adjusted_full_points
FROM product.feedback
ORDER BY feedback_id;
RESULT — exact output from the displayed Queryflo rows
feedback_idratingadjusted_full_points
154
243
343
432

FLOOR keeps only completed whole points after the 0.9 adjustment.

Now You Try

Practice this concept

Product wants completed full rating points after a calculated adjustment.

Available schema
product

Prefix tables with product.table_name.

feedback_idratingadjusted_full_points
product.feedback
ColumnType
idinteger
user_idinteger
feature_idinteger
ratinginteger
nps_scoreinteger
commenttext
created_attimestamp with time zone
moderation_buckettext
query.sql
Intermediate business practice

Sign up free to try it on a real business scenario