Save up to $499! Grab all Python courses for $49 or all online courses we’ve ever launched for only $169. Only Feb 11-16. Happy Valentine's!
6. Sort by a few columns
Eliminating duplicate results
HAVING: filtering and ordering groups
Let's practice


Good job. Alright, one more thing before we move on: you can sort your results by more than one column and each of them can be sorted in a different order:

FROM order 
ORDER BY customer_id ASC, total_sum DESC;

As you can see, the results will be first sorted by customer_id in the ascending order (lowest values first) and then, for each customer_id, the orders will be sorted by the total_sum in the descending order (greatest values first).


Select all rows from the table employees and sort them in the ascending order by the department and then in the descending order by the salary.

Stuck? Here's a hint!


FROM employees 
ORDER BY department ASC, salary DESC;