Tag archive
Commands grouped around the same concept, pattern, or recurring problem.
Use `WIDTH_BUCKET(value, low, high, n)` to assign each row to one of `n` equal-width buckets between `low` and `high` — the foundation for building numeric histograms directly in SQL.
Use `ABS` to strip the sign from a number and `MOD` (or the `%` operator) to get the integer remainder after division.
Use `SIGN` to reduce any number to -1, 0, or 1 based on whether it is negative, zero, or positive.
Control the precision or snapping of numeric results using `ROUND` for half-up rounding, `CEIL` to round up to the next integer, and `FLOOR` to round down.