MySQL correlated subquery
In the previous examples, you notice that the subquery is independent. It means you can execute the subquery as a single query. However, a correlated subquery is a subquery that uses the information from the outer query, or you can say that a correlated subquery depends on the outer query. A correlated subquery is evaluated once for each row in the outer query.
In the following correlated subquery, we select products whose buy prices are greater than the average buy price of all products for a specific product line.