Slide 14.8: The INSERT INTO statement Slide 14.10: The SELECT statement (cont.) Home |
SELECT
Statement
SELECT
statement is used to select data from a table.
The tabular result is stored in a result table (called the result-set).
The syntax on the right is for the SELECT statement:
|
|
SELECT
statement like this:
LastName | FirstName | Address | City |
---|---|---|---|
Hansen | Ola | Timoteivn 10 | Sandnes |
Svendson | Tove | Borgvn 23 | Sandnes |
Pettersen | Kari | Storgt 20 | Stavanger |
Rasmussen | Storgt 67 |
SQL> select LastName, FirstName from Persons; LASTNAME FIRSTNAME --------------------------- --------------------------- Hansen Ola Svendson Tove Pettersen Kari Rasmussen |
Persons
table, use a *
symbol instead of column names.
SQL> select * from Persons; LASTNAME FIRSTNAME ADDRESS CITY -------------- --------------- -------------- ------------ Hansen Ola Timoteivn 10 Sandnes Svendson Tove Borgvn 23 Sandnes Pettersen Kari Storgt 20 Stavanger Rasmussen Storgt 67 |
Customers
table may be created by the following command:
SQL> create table Customers ( 2 CustomerID varchar(16), 3 CompanyName varchar(32), 4 ContactName varchar(32), 5 Address varchar(64), 6 City varchar(32), 7 PostalCode varchar(16), 8 Country varchar(32) );Note that the
Customers
table is for read only.