Complete the code to sort the employees by their salary in ascending order.
SELECT * FROM employees ORDER BY salary [1];The ORDER BY clause sorts the results. ASC means ascending order.
Complete the code to sort the products by price in descending order.
SELECT * FROM products ORDER BY price [1];The ORDER BY clause sorts the results. DESC means descending order.
Fix the error in the query to sort customers by their last name in ascending order.
SELECT * FROM customers ORDER BY last_name [1];To sort in ascending order, use ASC after the column name in ORDER BY.
Fill both blanks to sort the orders by order_date descending and then by customer_id ascending.
SELECT * FROM orders ORDER BY order_date [1], customer_id [2];
The query sorts first by order_date in descending order, then by customer_id in ascending order.
Fill all three blanks to sort the employees by department ascending, then salary descending, then hire_date ascending.
SELECT * FROM employees ORDER BY department [1], salary [2], hire_date [3];
The query sorts employees by department ascending, salary descending, and hire_date ascending.