SQL Docs
SQL referenceCore SQLFunctionsJoinsWindow functions

SQL functions

Practical SQL function reference pages for the most-used patterns.

Common building blocks

Why these matter

Most business logic fails not because of a complex algorithm, but because the team did not agree on:

  • what counts as a row
  • how NULL values are treated
  • how ties are ordered
  • whether a window function or aggregate is the right tool

Good habits

  • prefer explicit ORDER BY in window functions
  • use PARTITION BY for per-group ranking
  • guard nullable results with COALESCE or CASE
  • document tie policy when ranking and paging
  • add a stable tiebreaker before shipping user-facing ranking logic

On this page