Unit 1, lesson 7 · ORDER BY, LIMIT
Sorting with ORDER BY and keeping the top rows
The five priciest products
ORDER BY sorts the result. ASC (the default) goes smallest or oldest first, DESC goes largest or newest first. Add LIMIT after it to keep only the first few rows, which is how you get a top 5 or a bottom 10.
SELECT name, signup_date
FROM customers
ORDER BY signup_date DESC
LIMIT 3;Your task
Which five products cost the most? Show their name and price, most expensive first.
Tables you will use: products
Try it in your browserFree, no sign-up. Your query is checked as you go.