Complete the code to order the results by the column 'name' in ascending order.
SELECT * FROM employees ORDER BY [1];The ORDER BY clause sorts the results by the specified column. Here, ordering by name arranges the rows alphabetically by employee name.
Complete the code to order the results by 'salary' in descending order.
SELECT * FROM employees ORDER BY salary [1];The keyword DESC after ORDER BY salary sorts the salaries from highest to lowest.
Fix the error in the code to correctly order results by 'age' ascending.
SELECT * FROM employees ORDER [1] age;The correct syntax is ORDER BY age. The keyword BY is required after ORDER.
Fill both blanks to order results by 'department' ascending and then by 'salary' descending.
SELECT * FROM employees ORDER BY [1] [2];
The query orders first by department in ascending order (default or specified by ASC), then by salary descending if needed.
Note: This example only fills the first ordering column and its direction; to order by two columns, the query would list both with their directions separated by commas.
Fill all three blanks to order results by 'department' ascending, then 'salary' descending, then 'age' ascending.
SELECT * FROM employees ORDER BY [1] [2], [3] ASC;
This query orders by department ascending (default), then by salary descending, and finally by age ascending.