
Daniel, PhD 🎓
3.2K posts

Daniel, PhD 🎓
@Daniel_5phd
DM if you have opportunities in the I.T.


SQL Tip: How Order By Works with Multiple Columns When using ORDER BY with multiple columns, the database initially sorts the entire result set based on the first column specified (the sales column in this case). This creates "groups" of rows that have the same value for the first column; e.g., rows that have a sales value of 12,000. The secondary sort (age ASC), unlike the first sort that is applied to the entire table, will be applied to the groups. In this output, you can see that rows with the same sales value have been grouped. For example, Mira and Bob have been grouped because they have the same sales value (12,000). The primary sort, based on the sales column in descending order, resulted in a tie between Mira and Bob. The secondary sort serves as the tiebreaker. Since we are sorting by the age column in ascending order, Mira, who is 30, is placed before Bob. This process is repeated for all tied values in the primary sort. #DataAnalytics






















