Complete the code to order the results 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, we want to sort by age.
Complete the code to order the results by 'score' in descending order.
SELECT * FROM results ORDER BY [1] DESC;To sort from highest to lowest, use ORDER BY score DESC.
Fix the error in the code to order by 'salary' in ascending order with NULL values appearing last.
SELECT * FROM employees ORDER BY salary [1] NULLS LAST;To order salaries ascending and place NULLs last, use ORDER BY salary ASC NULLS LAST.
Fill both blanks to order by 'date' descending and place NULL values first.
SELECT * FROM events ORDER BY date [1] NULLS [2];
Ordering by date descending with NULLs first uses ORDER BY date DESC NULLS FIRST.
Fill all three blanks to order by 'rating' ascending, place NULLs last, and then by 'name' ascending.
SELECT * FROM products ORDER BY rating [1] NULLS [2], name [3];
This orders products by rating ascending with NULLs last, then by name ascending: ORDER BY rating ASC NULLS LAST, name ASC.