Introduction to Database Systems Queries in SQL The select ...
Introduction to Database Systems Queries in SQL The select ...
Introduction to Database Systems Queries in SQL The select ...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Correlated Subqueries<br />
It may be necessary <strong>to</strong> use <strong>in</strong> <strong>in</strong>ner blocks variables that are<br />
def<strong>in</strong>ed <strong>in</strong> outer blocks. In this case one talks about correlated<br />
subqueries.<br />
Example: <strong>The</strong> fathers all of whose children earn strictly more than<br />
20k.<br />
<strong>select</strong> dist<strong>in</strong>ct fc.father<br />
from fatherChild fc<br />
where not exists (<strong>select</strong> *<br />
from fatherChild fc0, person c<br />
where fc.father = fc0.father<br />
and fc0.child = c.name<br />
and c.<strong>in</strong>come