0
0
MySQLquery~10 mins

Why aggregation summarizes data 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 count the number of employees in the table.

MySQL
SELECT COUNT([1]) FROM employees;
Drag options to blanks, or click blank then click option'
Aname
Bemployee_id
C*
Dsalary
Attempts:
3 left
💡 Hint
Common Mistakes
Using COUNT with a specific column may miss NULL values.
Forgetting to use COUNT function.
2fill in blank
medium

Complete the code to find the average salary of employees.

MySQL
SELECT AVG([1]) FROM employees;
Drag options to blanks, or click blank then click option'
Aemployee_id
Bsalary
Cname
Ddepartment
Attempts:
3 left
💡 Hint
Common Mistakes
Using AVG on non-numeric columns.
Using SUM instead of AVG.
3fill in blank
hard

Fix the error in the code to get the total salary paid to employees.

MySQL
SELECT [1](salary) FROM employees;
Drag options to blanks, or click blank then click option'
ASUM
BCOUNT
CAVG
DMAX
Attempts:
3 left
💡 Hint
Common Mistakes
Using COUNT instead of SUM.
Using AVG when total sum is needed.
4fill in blank
hard

Fill both blanks to find the maximum and minimum salaries.

MySQL
SELECT [1](salary) AS max_salary, [2](salary) AS min_salary FROM employees;
Drag options to blanks, or click blank then click option'
AMAX
BMIN
CSUM
DAVG
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up MAX and MIN functions.
Using SUM or AVG instead of MAX or MIN.
5fill in blank
hard

Fill all three blanks to get the count, average, and total salary for employees.

MySQL
SELECT [1](*) AS total_employees, [2](salary) AS average_salary, [3](salary) AS total_salary FROM employees;
Drag options to blanks, or click blank then click option'
ACOUNT
BAVG
CSUM
DMAX
Attempts:
3 left
💡 Hint
Common Mistakes
Using MAX instead of SUM for total salary.
Using COUNT on salary instead of COUNT(*).