Equal sort keys need another column for exact order.

highlighted = computed this step

Ties need a tie breaker

Sorting only by score leaves rows with equal scores tied.

equal keys tie\text{equal keys tie}

Show tied groups

The compiler finds 2 tie groups, so unstableTies is yes.

tie groups=2\text{tie groups}=2

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

Ties need a tie breaker: base tablesourceRowidkindscore01book9012game7523book7534game9045book90 order bycolumndirectionscoredesc sort keyssourceRowkey0[90]1[75]2[75]3[90]4[90] ordered rowssourceRowidkindscore01book9034game9045book9012game7523book75 page rowssourceRowidkindscore01book9034game9045book9012game7523book75 tie groupskeysourceRows[90][0, 3, 4][75][1, 2] order factsfactvaluerowCount5orderColumnCount1orderedRowCount5offset0limitnonepageRowCount5skippedBeforeCount0skippedAfterCount0unstableTiesyesdeterministicTieOrderinput_row_index

Honest tie order

The renderer uses input row index only to make this tiny diagram deterministic; the lesson flags the tie.

diagram order is guarded\text{diagram order is guarded}

Summary

Add a tie-breaker column when the exact row order matters.

make ties explicit\text{make ties explicit}