AI engineering glossary · SQL databases

What is ORDER BY?

ORDER BY: The clause that sorts a query's result by one or more columns or expressions, ascending by default or descending with DESC. Without it, row order is not guaranteed and may change between runs.

Level: beginnerTopic: SQL databases

ORDER BY: an example

ORDER BY amount DESC, order_date ASC lists biggest orders first, breaking ties with the earliest date.

Related terms

More SQL databases terms

Where you learn it

ORDER BY is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.