The SELECT keyword determines which fields an SQL statement will involve. They are taken from the table(s) listed after the FROM keyword.
In the example below, the name and grade fields are being displayed. Note the comma. One is required for each field listed past the first.
first_name | grade |
Guy | 88 |
James | 73 |
Alice | 96 |
Holly | 83 |
To get every field without having to explicitly list it out, use an asterisk (*) instead.
id | last_name | first_name | grade |
001 | Holmes | Guy | 88 |
002 | Atwell | James | 73 |
003 | O'Hara | Alice | 96 |
004 | Peterson | Holly | 83 |
Following is an interactive SQL query. Click on the second through fourth fields to add or remove them from the query.
name | capital | language | population |
Spain | Madrid | Spanish | 47350000 |
Iceland | Reykjavík | Icelandic | 366425 |
Peru | Lima | Spanish | 32000000 |
Vietnam | Hanoi | Vietnamese | 97340000 |
The content on this site is the property of Milo Roberts (MiloRoberts.com) and may not be reproduced.