data-engineering-book icon indicating copy to clipboard operation
data-engineering-book copied to clipboard

line 610

Open evelinesurbakti opened this issue 3 years ago • 1 comments

any simple explanation about multiple column order? could it be based on priority order?

evelinesurbakti avatar May 30 '21 10:05 evelinesurbakti

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.

oleg-agapov avatar May 30 '21 20:05 oleg-agapov