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.

Exercise 2: Solution<br />

<strong>select</strong> salary,<br />

salary*2 as doubleSalary<br />

from employee<br />

where branch = ‘Glasgow' or<br />

branch = ‘London'<br />

salary<br />

64<br />

44<br />

64<br />

doubleSalary<br />

128<br />

88<br />

128<br />

19<br />

Selection, Projection, and Jo<strong>in</strong><br />

• Us<strong>in</strong>g <strong>select</strong> statements with a s<strong>in</strong>gle relation <strong>in</strong> the<br />

from clause we can realise:<br />

– <strong>select</strong>ions,<br />

– projections,<br />

– renam<strong>in</strong>gs<br />

• Jo<strong>in</strong>s (and Cartesian products) are realised by us<strong>in</strong>g two<br />

or more relations <strong>in</strong> the from clause<br />

20

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

Saved successfully!

Ooh no, something went wrong!