
Mastering MySQL: HAVING and GROUP BY

Quiz
•
Computers
•
7th Grade
•
Hard
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
Similar Resources on Wayground
10 questions
Spreadsheet Homework 2

Quiz
•
7th Grade
7 questions
Threats to Data, Info & Systems

Quiz
•
7th - 12th Grade
10 questions
Business Management

Quiz
•
6th - 8th Grade
10 questions
Software - Different Types of Software

Quiz
•
4th - 12th Grade
11 questions
Artificial Intelligence

Quiz
•
7th Grade
10 questions
Knowledge Check: What is the Internet?

Quiz
•
6th - 8th Grade
10 questions
Employability Skills

Quiz
•
6th - 8th Grade
15 questions
Year 9 Databases Quiz

Quiz
•
7th - 10th Grade
Popular Resources on Wayground
15 questions
Hersheys' Travels Quiz (AM)

Quiz
•
6th - 8th Grade
20 questions
PBIS-HGMS

Quiz
•
6th - 8th Grade
30 questions
Lufkin Road Middle School Student Handbook & Policies Assessment

Quiz
•
7th Grade
20 questions
Multiplication Facts

Quiz
•
3rd Grade
17 questions
MIXED Factoring Review

Quiz
•
KG - University
10 questions
Laws of Exponents

Quiz
•
9th Grade
10 questions
Characterization

Quiz
•
3rd - 7th Grade
10 questions
Multiply Fractions

Quiz
•
6th Grade
Discover more resources for Computers
15 questions
Hersheys' Travels Quiz (AM)

Quiz
•
6th - 8th Grade
20 questions
PBIS-HGMS

Quiz
•
6th - 8th Grade
30 questions
Lufkin Road Middle School Student Handbook & Policies Assessment

Quiz
•
7th Grade
17 questions
MIXED Factoring Review

Quiz
•
KG - University
10 questions
Characterization

Quiz
•
3rd - 7th Grade
20 questions
Guess The Cartoon!

Quiz
•
7th Grade