Loading

Quipoin Menu

Learn • Practice • Grow

sql / Correlated Subqueries
mcq
Direction: Choose the correct option

Q1.

What is a correlated subquery?
A. References outer query
B. Faster subquery
C. Independent subquery
D. Table subquery
Direction: Choose the correct option

Q2.

SELECT * FROM employees e1 WHERE salary > (SELECT AVG(salary) FROM employees e2 WHERE e2.dept_id = e1.dept_id);
How does this correlate?
A. No correlation
B. Using different tables
C. e2.dept_id = e1.dept_id links them
D. Using same table
Direction: Choose the correct option

Q3.

SELECT * FROM departments d WHERE EXISTS (SELECT 1 FROM employees e WHERE e.dept_id = d.id);
What does this find?
A. Employees only
B. Departments without employees
C. Departments with employees
D. All departments
Direction: Choose the correct option

Q4.

SELECT * FROM products p1 WHERE price > (SELECT AVG(price) FROM products p2 WHERE p2.category = p1.category);
What does this query do?
A. All products
B. Expensive products
C. Cheap products
D. Products above category average
Direction: Choose the correct option

Q5.

How does performance of correlated subqueries compare?
A. Same as joins
B. Always faster
C. Uses indexes only
D. Slower for large tables