ORDER BY and LIMIT — Sorting Results

How to sort results ascending or descending by multiple columns, and limit the number of rows returned. ## Lesson objectives In this lesson, we will learn how to sort SQL results and how to limit the number of rows shown in the result. In the previous lessons, we learned how to choose columns with and how to filter rows with . But in real work, selecting and filtering data is not always enough. We often need to see the result in a specific order. For example: show employees with the highest salary first sort sales by date show the newest orders first find the cheapest products show only the first 10 results show the top 5 highest-paid employees For these cases, we use and .