Ascending order puts smaller keys first.

highlighted = computed this step

Sort ascending

Ascending order puts the smallest sort key first.

smallest first\text{smallest first}

Sort by score

The first score after sorting is 10, with 3 rows shown.

first score=10\text{first score}=10

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

Sort ascending: base tablesourceRowidkindscore01book3012game1023tool20 order bycolumndirectionscoreasc sort keyssourceRowkey0[30]1[10]2[20] ordered rowssourceRowidkindscore12game1023tool2001book30 page rowssourceRowidkindscore12game1023tool2001book30 tie groupskeysourceRowsnonenone order factsfactvaluerowCount3orderColumnCount1orderedRowCount3offset0limitnonepageRowCount3skippedBeforeCount0skippedAfterCount0unstableTiesnodeterministicTieOrdernot_needed

Read the sort keys

The sort-keys table shows the score used for each source row.

key is score\text{key is score}

Summary

The ordered rows are recomputed from the key column.

ORDER BY score ASC\text{ORDER BY score ASC}