ORDER BY decides how SQL arranges the rows, while LIMIT decides how many rows remain in the result. We need both when a request asks for the top customers, the lowest sales, or the latest orders.
However, we still have one decision to make. What does “top” mean for the question we are answering? A customer can be at the top by total spend, number of orders, or recent growth. The query can run correctly while sorting by the wrong value.
In this module, we’ll use a small customer table to find the highest and lowest spend values. After that, we’ll compare two ways to handle customers who have the same value at the cutoff.



