Description:
ROUND, CEIL, FLOOR, TRUNC, ABS, SIGN and MOD in Snowflake. Snowflake sends a half away from zero, so ROUND(2.5) is 3 and ROUND(-2.5) is -3. We run all four rounding functions on a positive and then on a negative to see which ones pair up, use a negative second argument to round to hundreds and thousands, and finish on MOD, whose sign follows the dividend.
READ THE WRITTEN TUTORIAL
https://www.techbrothersit.com/2026/10/snowflake-sql-tutorial-70-round-ceil.html
WHAT YOU WILL LEARN
• Round to hundreds and thousands with a negative second argument
• Know which way Snowflake sends a half, in both directions
• See why ROUND sides with CEIL on a positive and with FLOOR on a negative
• Understand why 2.675 rounds differently here than in most languages
• Use ABS and SIGN, including their NULL and negative-zero edges
• Avoid the MOD portability bug when porting a bucketing calculation
CHAPTERS
0:00 Intro
0:14 Orders, and the spread of it
0:33 Which way does a half go?
2:03 Round, ceiling, floor, truncate
4:00 Two small ones
4:41 The remainder, and its sign
6:25 Recap & wrap-up
#Snowflake #SnowflakeSQL #SQL #DataEngineering #TechBrothersIT
Share this link via
Or copy link


























