Saltar al contenido principal

Use ORDER BY for promises, not decoration

Explain why LIMIT without ORDER BY is not a stable top-N query.

sql-fundamentals5 min read

ORDER BY is the difference between a result set and a ranked answer. A table scan, an index scan, and a parallel plan can all produce valid but different row orders unless the query specifies one. This matters whenever stakeholders interpret position as meaning: latest events, biggest customers, first failed jobs, most recent invoices. Add a tie-breaker when equal metric values would otherwise make the order unstable.

Read the full lesson

Sign up free: one personalized lesson every day, matched to your role and goals.

← Back to library

Contáctanos