Using subqueries

You can use subqueries in a search condition as another way to select data. Subqueries can be used anywhere an expression can be used.

Conceptually, a subquery is evaluated whenever a new row or a group of rows must be processed. In fact, if the subquery is the same for every row or group, it is evaluated only once. Subqueries like this are said to be uncorrelated.

Some subqueries return different values from row to row or group to group. The mechanism that allows this is called correlation, and the subqueries are said to be correlated.