Loading

Quipoin Menu

Learn • Practice • Grow

sql / SQL HAVING
mcq
Direction: Choose the correct option

Q1.

SELECT department, COUNT(*) FROM employees GROUP BY department HAVING COUNT(*) > 5;
What does HAVING do?
A. Filters columns
B. Filters groups after grouping
C. Sorts results
D. Filters rows before grouping
Direction: Choose the correct option

Q2.

SELECT department, AVG(salary) FROM employees GROUP BY department HAVING AVG(salary) > 60000;
Which departments are returned?
A. Departments with high salaries
B. All departments
C. Departments with average salary > 60000
D. Departments with low salaries
Direction: Choose the correct option

Q3.

SELECT department, SUM(salary) FROM employees GROUP BY department HAVING SUM(salary) > 500000;
What condition must departments meet?
A. Average salary high
B. Department name starts with S
C. More than 5 employees
D. Total salary > 500000
Direction: Choose the correct option

Q4.

SELECT department, COUNT(*), AVG(salary) FROM employees GROUP BY department HAVING COUNT(*) > 5 AND AVG(salary) > 55000;
How many conditions in HAVING?
A. Three conditions
B. One condition
C. Two conditions
Direction: Choose the correct option

Q5.

What's the difference between WHERE and HAVING?
A. Both are same
B. WHERE works with aggregates
C. HAVING is faster
D. WHERE filters rows, HAVING filters groups