Loading

Quipoin Menu

Learn • Practice • Grow

sql / SQL Subqueries
mcq
Direction: Choose the correct option

Q1.

What is a subquery?
A. View definition
B. Table alias
C. A query inside another query
D. Another name for join
Direction: Choose the correct option

Q2.

SELECT * FROM employees WHERE salary > (SELECT AVG(salary) FROM employees);
What type of subquery is this?
A. Scalar subquery
B. Table subquery
C. Correlated subquery
D. Row subquery
Direction: Choose the correct option

Q3.

SELECT name, salary, (SELECT AVG(salary) FROM employees) AS avg_salary FROM employees;
Where is the subquery placed?
A. SELECT clause
B. FROM clause
C. WHERE clause
D. HAVING clause
Direction: Choose the correct option

Q4.

SELECT * FROM employees WHERE dept_id IN (SELECT id FROM departments WHERE location = 'New York');
What operator is used with this subquery?
A. IN
B. <
C. >
D. =
Direction: Choose the correct option

Q5.

SELECT * FROM customers c WHERE EXISTS (SELECT 1 FROM orders o WHERE o.customer_id = c.id);
What does EXISTS check?
A. If values match
B. If subquery is false
C. If subquery returns any rows
D. If subquery is true