Difference between revisions of "SELECT .. WHERE"
From SQLZOO
(Created page with " <h1>SELECT .. WHERE</h1> <p>The table <code>games</code> shows the year and the city hosting the Olympic Games.</p> <table> <caption align='center'>games</caption> <tr><th al...") |
|||
| Line 9: | Line 9: | ||
<tr><td>2008</td><td align='left'>Beijing</td></tr> | <tr><td>2008</td><td align='left'>Beijing</td></tr> | ||
<tr><td>2012</td><td align='left'>London</td></tr> | <tr><td>2012</td><td align='left'>London</td></tr> | ||
| + | </table> | ||
<div class='ht'> | <div class='ht'> | ||
The SELECT statement returns results from a table. | The SELECT statement returns results from a table. | ||
| Line 14: | Line 15: | ||
In this example shows the year that Athens hosted the Olympic games. | In this example shows the year that Athens hosted the Olympic games. | ||
<div class=params>schema:scott</div> | <div class=params>schema:scott</div> | ||
| − | |||
| − | |||
| − | |||
| − | |||
<source lang='sql' class='def'> | <source lang='sql' class='def'> | ||
SELECT yr, city | SELECT yr, city | ||
Revision as of 15:37, 16 July 2012
SELECT .. WHERE
The table games shows the year and the city hosting the Olympic Games.
| yr | city |
|---|---|
| 2000 | Sydney |
| 2004 | Athens |
| 2008 | Beijing |
| 2012 | London |
The SELECT statement returns results from a table. With a WHERE clause only some rows are returned. In this example shows the year that Athens hosted the Olympic games.
schema:scott
SELECT yr, city FROM games
See also