Introduction
A correlated subquery helps find related data by using values from the main query. It runs once for each row in the main query to give precise matching results.
When you want to compare each row in a table with related rows in another table.
When you need to filter rows based on a condition that depends on each row's data.
When you want to calculate a value for each row using data from another table.
When you want to check if a related record exists for each row in the main query.