WeCodeAcademy

ORDER BY and LIMIT

ORDER BY sorts the result (ascending by default; add DESC to reverse). LIMIT keeps only the first few rows.

Examplesql
Open in editor »

Together they answer "top N" questions, such as the three cheapest products.

Examplesql
Open in editor »
Quick check

How do you get the single most expensive product?

Your turn: write the code

Return the names of the two most expensive products, most expensive first.

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.