Complete the code to select all columns from the table ordered by the column 'age' in ascending order.
SELECT * FROM users ORDER BY [1];The ORDER BY clause sorts the results by the specified column. Here, ordering by age arranges users from youngest to oldest.
Complete the code to order the results by 'salary' in descending order.
SELECT * FROM employees ORDER BY [1] DESC;Using ORDER BY salary DESC sorts employees from highest to lowest salary.
Fix the error in the query to order by 'date_joined' ascending.
SELECT * FROM members ORDER BY [1] ASC;The correct column name is date_joined. Using the exact column name is necessary for the query to work.
Fill both blanks to order the products by 'category' ascending and then by 'price' descending.
SELECT * FROM products ORDER BY [1] [2], price DESC;
The query first orders by category ASC (alphabetically) and then by price DESC (highest price first) within each category.
Fill all three blanks to order the sales records by 'region' ascending, then 'sales_date' descending, and finally by 'amount' ascending.
SELECT * FROM sales ORDER BY [1] [2], [3] DESC, amount ASC;
The query orders sales by region ASC (alphabetically), then sales_date DESC (newest first), and finally amount ASC (lowest to highest).