Corelated Sub Queries

UDA
Fan

Corelated Sub Queries

How do Corelated Sub queries work? How do we identify and distinguish them from a normal sub query and how frequently are corelated sub queries used in practical applications.
Am new to teradata and it would be great if someone could walk me through the 'Corelated Sub query' concept with some simple explanatory codes.
Thanks .

Regards
Adi
1 REPLY
Enthusiast

Re: Corelated Sub Queries

When an instance of outer relation(table) is also refered in the inner sub-query, the query is said to be co-related. example

select....
from
tableA A where fld1=(select fld2 from tableB B where B.fld3=A.fld4)

For every fld1 in the tableA, the subquery will be run based on condition B.fld3=A.fld4.The outer table is here co-related with the inner sub-query/sub-table