0
0
MySQLquery~10 mins

ASC and DESC direction in MySQL - Interactive Code Practice

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

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

MySQL
SELECT * FROM users ORDER BY age [1];
Drag options to blanks, or click blank then click option'
AASC
BDESC
CSORT
DBY
Attempts:
3 left
💡 Hint
Common Mistakes
Using DESC instead of ASC will sort in descending order.
Using SORT or BY are not valid keywords here.
2fill in blank
medium

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

MySQL
SELECT * FROM employees ORDER BY salary [1];
Drag options to blanks, or click blank then click option'
ADESC
BUP
CASC
DDOWN
Attempts:
3 left
💡 Hint
Common Mistakes
Using ASC instead of DESC will sort in ascending order.
UP and DOWN are not valid SQL keywords for sorting.
3fill in blank
hard

Fix the error in the code to correctly sort by 'date_joined' in descending order.

MySQL
SELECT * FROM members ORDER BY date_joined [1];
Drag options to blanks, or click blank then click option'
AASCE
BDOWN
CDECS
DDESC
Attempts:
3 left
💡 Hint
Common Mistakes
Misspelling DESC as ASCE or DECS.
Using DOWN which is not a valid SQL keyword.
4fill in blank
hard

Fill both blanks to sort by 'price' ascending and then by 'name' descending.

MySQL
SELECT * FROM products ORDER BY price [1], name [2];
Drag options to blanks, or click blank then click option'
AASC
BDESC
CDOWN
DUP
Attempts:
3 left
💡 Hint
Common Mistakes
Using DOWN or UP which are not valid SQL keywords.
Mixing up ASC and DESC order.
5fill in blank
hard

Fill all three blanks to sort by 'category' ascending, 'stock' descending, and 'rating' ascending.

MySQL
SELECT * FROM inventory ORDER BY category [1], stock [2], rating [3];
Drag options to blanks, or click blank then click option'
AASC
BDESC
DDOWN
Attempts:
3 left
💡 Hint
Common Mistakes
Using DOWN instead of DESC.
Using DESC for ascending order.