29.01.2014 Views

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 ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Intersection by Way of Nest<strong>in</strong>g<br />

<strong>select</strong> name from employee<br />

<strong>in</strong>tersection<br />

<strong>select</strong> lastName as name from employee<br />

<strong>select</strong> name<br />

from employee<br />

where name <strong>in</strong> (<strong>select</strong> lastName<br />

from employee)<br />

<strong>select</strong> name<br />

from employee e<br />

where exists (<strong>select</strong> *<br />

from employee<br />

where lastName = e.name)<br />

95<br />

Intersection Without Nest<strong>in</strong>g<br />

Is it possible <strong>to</strong> express <strong>in</strong>tersection without nest<strong>in</strong>g?<br />

<strong>select</strong> name from employee<br />

<strong>in</strong>tersection<br />

<strong>select</strong> lastName as name from employee<br />

96

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!