Difference between revisions of "SELECT Reference"
Jump to navigation
Jump to search
<tbody></tbody>
Line 4: | Line 4: | ||
The output from a SELECT statement is always a grid - with a number of rows and a number of columns. | The output from a SELECT statement is always a grid - with a number of rows and a number of columns. | ||
The simplest SELECT commands involve a single table: | The simplest SELECT commands involve a single table: | ||
<source lang='sql'> | |||
<source lang='sql | |||
SELECT name, population | SELECT name, population | ||
FROM bbc | FROM bbc | ||
WHERE region='North America' | WHERE region='North America' | ||
</source> | </source> | ||
</ | <table class="sqlmine"><tbody><tr><th>name</th><th>population</th></tr><tr><td>Canada</td><td class="r">32000000</td></tr><tr><td>Mexico</td><td class="r">106400000</td></tr><tr><td>United States of America</td><td class="r">295000000</td></tr></tbody></table> | ||
*The SELECT line determines which columns to show - in this case <code>name</code> and <code>population</code>, both of which are columns of the bbc ta le. | |||
*The WHERE clause determines which rows to show |
Revision as of 10:07, 11 August 2012
The SELECT command is used to show data from a database.
The output from a SELECT statement is always a grid - with a number of rows and a number of columns. The simplest SELECT commands involve a single table:
SELECT name, population
FROM bbc
WHERE region='North America'
name | population |
---|---|
Canada | 32000000 |
Mexico | 106400000 |
United States of America | 295000000 |
- The SELECT line determines which columns to show - in this case
name
andpopulation
, both of which are columns of the bbc ta le. - The WHERE clause determines which rows to show