Expected order facts are assertions only; compiler output is the source of truth.

highlighted = computed this step

Honest by construction

Each lesson compiles raw rows and order rules, turns recomputed facts into expected assertions, then compiles again.

expected is assertion only\text{expected is assertion only}

Show the guarded order

The guarded order uses 2 order columns and returns 3 page rows.

page rows=3\text{page rows}=3

Ordering examples are tiny finite table transforms; SQL dialects, NULL ordering, collations, indexes, optimizer behavior, performance, and product behavior are out of scope.

Guarded order facts: base tablesourceRowidkindscore01book9012game7523book7534game9045book90 order bycolumndirectionscoredescidasc sort keyssourceRowkey0[90, 1]1[75, 2]2[75, 3]3[90, 4]4[90, 5] ordered rowssourceRowidkindscore01book9034game9045book9012game7523book75 page rowssourceRowidkindscore01book9034game9045book90 tie groupskeysourceRowsnonenone order factsfactvaluerowCount5orderColumnCount2orderedRowCount5offset0limit3pageRowCount3skippedBeforeCount0skippedAfterCount2unstableTiesnodeterministicTieOrdernot_needed

Try to tamper

Wrong expected facts, derived sidecars, duplicate columns, missing order columns, bad directions, and negative limits fail closed.

fail closed before render\text{fail closed before render}

Summary

Book twenty-two stays inside finite ORDER BY, LIMIT, and OFFSET behavior.

recomputed order facts\text{recomputed order facts}