Complete the code to sort the employees by their age in ascending order.
SELECT * FROM employees ORDER BY [1];The ORDER BY clause sorts the result by the specified column. Here, sorting by age arranges employees from youngest to oldest.
Complete the code to list products sorted by their price from lowest to highest.
SELECT product_name, price FROM products ORDER BY [1];Sorting by price arranges products from the cheapest to the most expensive.
Fix the error in the query to sort customers by their last name.
SELECT * FROM customers ORDER BY [1];firstname instead of lastname.The column to sort by last name is lastname. Using firstname or others will not sort by last name.
Fill both blanks to select all orders and sort them by order date in descending order.
SELECT * FROM orders ORDER BY [1] [2];
To sort orders by date from newest to oldest, use ORDER BY order_date DESC.
Fill all three blanks to select product names and prices, sorting by price ascending.
SELECT [1], [2] FROM products ORDER BY [3];
Select product_name and price columns, then sort by price ascending by default.