5 questions to test your understanding
You run: SELECT * FROM employees WHERE id NOT IN (SELECT manager_id FROM departments). You expect some results, but get zero rows, even though many employees are not managers. What is the most likely cause?
What distinguishes a correlated subquery from a non-correlated subquery?
A subquery used as a derived table in the FROM clause must be given an alias.
A correlated subquery typically executes once per outer row, making it slower than an equivalent JOIN regardless of the database optimizer used.
Why should you use NOT EXISTS rather than NOT IN when your subquery might return NULL values?