Hi! Similar to the sort function in Excel, I was wondering if SQL allows you to use ORDER BY in order to sort the data through multiple layers?

Thanks for your help!

You can use it with GROUP BY or HAVING (and WHERE. but remember that HAVING filters groups, WHERE filters rows. I know you didn’t ask about that… I just wanted to mention it).

GROUP BY will arrange the rows into groups and the w/ ORDER BY it sorts the rows within the groups. You can use ORDER BY w/ multiple columns and the rows will be ordered by whatever col. is first.

1 Like

In addition it also has some similar functions such as average, sum, count, min and max. The cheat sheet for SQL has some good examples of these as well as group by/ order by.