A SELECT statement whose results are used in filtering the main query is called?
Assesses fundamental understanding of SQL & Databases conventions, runtime behavior, and memory/performance considerations.
Hiring managers look for precision, avoidance of ambiguous jargon, and ability to explain trade-offs under real production conditions.
A SELECT statement nested inside another SQL statement to supply values for filtering or computation is called a subquery (also known as an inner query or nested query):
SELECT product_name, price
FROM products
WHERE price > (
SELECT AVG(price) FROM products
);
### Types of Subqueries:
- Scalar Subquery: Returns exactly one row and one column.
- Multi-Row Subquery: Returns a list of values, evaluated with
IN,ANY, orALL. - Correlated Subquery: References columns from the outer query, re-evaluated for each outer row.
Candidate Response Strategy & Interview Tips
- Start with a concise one-sentence summary: Deliver a direct, confident answer first before expanding into nuances.
- Demonstrate real-world trade-offs: Discuss where this approach excels and when you would avoid it in production systems.
- Discuss complexity & edge cases: Proactively explain time/space complexity or boundary conditions (null values, scale limits).
- Prepare for interviewer follow-ups: Technical hiring panels frequently probe deeper into concurrency, backward compatibility, or alternative libraries.