ORDER BY can use a second key to make ties explicit.
highlighted = computed this step
Input table
Use repeated amounts so a tie-breaker matters.
Orders
Order query
Sort by amount descending, then order_id descending inside equal amounts.
ORDER BY amount DESC, order_id DESC
Ordered output
Rows with equal amounts visibly follow the second key.
two-key order