0
0
MySQLquery~10 mins

MIN and MAX functions 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 find the smallest price from the products table.

MySQL
SELECT [1](price) FROM products;
Drag options to blanks, or click blank then click option'
AMIN
BMAX
CSUM
DCOUNT
Attempts:
3 left
💡 Hint
Common Mistakes
Using MAX instead of MIN.
Using SUM or COUNT which do not return minimum values.
2fill in blank
medium

Complete the code to find the highest score from the scores table.

MySQL
SELECT [1](score) FROM scores;
Drag options to blanks, or click blank then click option'
AMIN
BCOUNT
CAVG
DMAX
Attempts:
3 left
💡 Hint
Common Mistakes
Using MIN instead of MAX.
Using AVG or COUNT which do not return maximum values.
3fill in blank
hard

Fix the error in the query to get the maximum age from the users table.

MySQL
SELECT [1]age) FROM users;
Drag options to blanks, or click blank then click option'
AMAX
BMIN(
CMAX(
DMIN
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting parentheses after MAX or MIN.
Using MIN instead of MAX.
4fill in blank
hard

Fill both blanks to find the smallest and largest salary from the employees table.

MySQL
SELECT [1](salary) AS min_salary, [2](salary) AS max_salary FROM employees;
Drag options to blanks, or click blank then click option'
AMIN
BMAX
CSUM
DCOUNT
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping MIN and MAX.
Using SUM or COUNT instead of MIN or MAX.
5fill in blank
hard

Fill all three blanks to find the minimum, maximum, and average rating from the reviews table.

MySQL
SELECT [1](rating) AS min_rating, [2](rating) AS max_rating, [3](rating) AS avg_rating FROM reviews;
Drag options to blanks, or click blank then click option'
AMIN
BMAX
CAVG
DCOUNT
Attempts:
3 left
💡 Hint
Common Mistakes
Using COUNT instead of AVG for average.
Mixing up MIN and MAX.