ASCending DESCending

suggest change
ORDER BY x ASC  -- same as default
ORDER BY x DESC  -- highest to lowest
ORDER BY lastname, firstname  -- typical name sorting; using two columns
ORDER BY submit_date DESC  -- latest first
ORDER BY submit_date DESC, id ASC  -- latest first, but fully specifying order.

But… Mixing ASC and DESC, as in the last example, cannot use a composite index to benefit. Nor will INDEX(submit_date DESC, id ASC) help – “DESC” is recognized syntactically in the INDEX declaration, but ignored.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents