Mastering MySQL: HAVING and GROUP BY

Mastering MySQL: HAVING and GROUP BY

7th Grade

10 Qs

quiz-placeholder

Similar activities

Business Management

Business Management

6th - 8th Grade

10 Qs

Databases

Databases

6th - 10th Grade

12 Qs

Cyber Security

Cyber Security

7th Grade

10 Qs

Collaboration Quizizz

Collaboration Quizizz

6th - 8th Grade

14 Qs

18-2 Exploring Image Editing Programs

18-2 Exploring Image Editing Programs

7th - 9th Grade

10 Qs

Employability Skills

Employability Skills

6th - 8th Grade

10 Qs

Front-end quiz

Front-end quiz

1st - 10th Grade

12 Qs

Mastering MySQL: HAVING and GROUP BY

Mastering MySQL: HAVING and GROUP BY

Assessment

Quiz

Computers

7th Grade

Hard

Created by

Sayeda Habeeba

Used 1+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the `HAVING` clause in MySQL?

To filter rows before grouping them

To filter groups after aggregation

To sort the results

To join tables

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is an example of an aggregate function in MySQL?

`SELECT`

`WHERE`

`COUNT()`

`JOIN`

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the following SQL query: `SELECT department, COUNT(*) FROM employees GROUP BY department;`. What does this query do?

It counts the total number of employees

It counts the number of employees in each department

It lists all departments

It lists all employees

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which clause would you use to filter the results of a `GROUP BY` query based on an aggregate function?

`WHERE`

`ORDER BY`

`HAVING`

`LIMIT`

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the difference between `WHERE` and `HAVING` clauses in MySQL?

`WHERE` filters rows before aggregation, `HAVING` filters after

`WHERE` filters after aggregation, `HAVING` filters before

Both filter after aggregation

Both filter before aggregation

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following queries correctly uses `HAVING` with `GROUP BY` to find departments with more than 10 employees?

`SELECT department FROM employees WHERE COUNT(*) > 10 GROUP BY department;`

`SELECT department FROM employees GROUP BY department HAVING COUNT(*) > 10;`

`SELECT department FROM employees GROUP BY department WHERE COUNT(*) > 10;`

`SELECT department FROM employees HAVING COUNT(*) > 10 GROUP BY department;`

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In the query `SELECT department, AVG(salary) FROM employees GROUP BY department HAVING AVG(salary) > 50000;`, what does `AVG(salary) > 50000` do?

It filters departments with an average salary less than $50,000

It filters departments with an average salary greater than $50,000

It calculates the average salary for all employees

It lists all departments

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?