MySQL DatabaseLesson 67Free preview
MySQL Order By
This lesson is part of PHP · All levels
Summary
The ORDER BY clause sorts the query results based on one or more columns, either up (ASC) or down (DESC). By default MySQL sorts upwards when the direction is not written. The sequence of more than one column is done by separating the column name using the kama.
Key points
- Order by column. ASC is up, DESC is down.
- Without directional guidance, ORDER BY default results in an upward order.
- Some columns of the order are written: ORDER BY city, name.
- Combined with LIMIT to display top data like champions or the latest.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.