IN Subquery
IN Subquery is a SQL statement in the Subqueries category. Checks if a value matches any value returned by the subquery. The syntax is SELECT * FROM table WHERE column IN (SELECT column FROM other_table);. It returns matching rows. A typical example: SELECT name FROM employees WHERE dept_id IN (SELECT id FROM departments WHERE budget > 500000); -- Employees in high-budget departments A close relative is Scalar Subquery, which a subquery that returns a single value (one row, one column). Can be used in SELECT, WHERE, HAVING clauses. A close relative is Correlated Subquery, which a subquery that references columns from the outer query. Evaluated for each row of the outer query. A close relative is EXISTS, which returns TRUE if the subquery returns at least one row. Often faster than IN for large datasets. More about this category: Nested queries — correlated, EXISTS, IN, ANY, ALL, scalar subqueries.