Introduction
Correlated subqueries let you compare each row in one table with rows in another table. They help find related data by checking conditions row by row.
When you want to find rows in one table that depend on values in another table for each row.
When you need to compare each employee's salary to the average salary in their department.
When you want to find customers who placed orders larger than their average order amount.
When you want to filter products that cost more than the average price in their category.