data-engineering-book
data-engineering-book copied to clipboard
line 610
any simple explanation about multiple column order? could it be based on priority order?
Sorting with multiple columns is done in the way you'd expect:
- it sorts by first column
- then, previously sorted data is sorted by second column
- and so on
Easiest analogy can be reproduced in Excel: take the data and sort it by column A, then by column B, etc. Then same will happen in SQL.
If you want a different priority, just change the order of columns in ORDER BY
statement.