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.

Expressions <strong>in</strong> the Target List<br />

<strong>select</strong> <strong>in</strong>come/4 as quarterlyIncome<br />

from person<br />

where name = ‘Greg'<br />

Complex Conditions <strong>in</strong> the “where” Clause<br />

<strong>select</strong> *<br />

from person<br />

where <strong>in</strong>come > 25<br />

and (age < 30 or age > 60)<br />

15<br />

<strong>The</strong> “like” Condition<br />

<strong>The</strong> persons hav<strong>in</strong>g a name that starts with 'A' and has a 'd' as the third<br />

letter:<br />

<strong>select</strong> *<br />

from person<br />

where name like 'A_d%‘<br />

• ‘_‘ matches a s<strong>in</strong>gle letter<br />

• ‘%‘ matches a str<strong>in</strong>g<br />

16

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

Saved successfully!

Ooh no, something went wrong!