When LIMIT cuts through tied sort values, an explicit tie-breaker makes the kept rows auditable.

highlighted = computed this step

Input table

Start with orders where two rows share the same amount.

Orders with ties\text{Orders with ties}
Ordersorder_idcategoryamounto1book30o2pen12o3book12o4paper45o5pen30

Order query

Order by amount first, then use order_id as the tie-breaker before applying the limit.

ORDER BY amount DESC, order_id ASC LIMIT\text{ORDER BY amount DESC, order\_id ASC LIMIT}
ORDER BY amount descending, order_id ascending LIMIT 2limit 2arity 3 rows 2order by amount desc,order_id ascarity 3 rows 5Ordersarity 3 rows 5

Ordered output

The limit keeps the first rows from that explicit tie-broken order.

tie-broken top rows\text{tie-broken top rows}
Ordered outputorder_idcategoryamounto4paper45o1book30