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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Exercise 3: Solution<br />

“<strong>The</strong> fathers of persons who earn more than 20K”<br />

π father (FatherChild<br />

child=name σ <strong>in</strong>come>20 (Person))<br />

<strong>select</strong> dist<strong>in</strong>ct fc.father<br />

from person p, fatherChild fc<br />

where fc.child = p.name<br />

and p.<strong>in</strong>come > 20<br />

27<br />

Exercise 4: Jo<strong>in</strong><br />

“Father and mother of every person”<br />

Write the query both <strong>in</strong> relational algebra and <strong>SQL</strong><br />

28

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

Saved successfully!

Ooh no, something went wrong!