0
0
MySQLquery~10 mins

Why ordering organizes results in MySQL - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to order the results by the column 'name' in ascending order.

MySQL
SELECT * FROM employees ORDER BY [1];
Drag options to blanks, or click blank then click option'
Aname
Bsalary
Cage
Ddepartment
Attempts:
3 left
💡 Hint
Common Mistakes
Using a column that does not exist in the table.
Forgetting to specify the column after ORDER BY.
2fill in blank
medium

Complete the code to order the results by 'salary' in descending order.

MySQL
SELECT * FROM employees ORDER BY salary [1];
Drag options to blanks, or click blank then click option'
AASC
BDESC
CBY
DFROM
Attempts:
3 left
💡 Hint
Common Mistakes
Using ASC instead of DESC for descending order.
Omitting the order direction keyword.
3fill in blank
hard

Fix the error in the code to correctly order results by 'age' ascending.

MySQL
SELECT * FROM employees ORDER [1] age;
Drag options to blanks, or click blank then click option'
AON
BFROM
CBY
DIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'ORDER FROM' or 'ORDER ON' instead of 'ORDER BY'.
Leaving out the keyword after ORDER.
4fill in blank
hard

Fill both blanks to order results by 'department' ascending and then by 'salary' descending.

MySQL
SELECT * FROM employees ORDER BY [1] [2];
Drag options to blanks, or click blank then click option'
Adepartment
Bsalary
CDESC
DASC
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up column names and order directions.
Using DESC for the first column when ascending is needed.
5fill in blank
hard

Fill all three blanks to order results by 'department' ascending, then 'salary' descending, then 'age' ascending.

MySQL
SELECT * FROM employees ORDER BY [1] [2], [3] ASC;
Drag options to blanks, or click blank then click option'
Adepartment
Bsalary
CDESC
Dage
Attempts:
3 left
💡 Hint
Common Mistakes
Placing order directions in wrong positions.
Confusing column names with order keywords.