Use the SELECT statement to select specific columns from a table. In the statement specify a list of column names separated by commas. This list is referred to as a select list.
The following statement selects department names (DEPTNAME) and department numbers (DEPTNUMB) from the ORG table of the SAMPLE database:
SELECT DEPTNAME, DEPTNUMB FROM ORG
The above statement produces the following result:
DEPTNAME DEPTNUMB -------------- -------- Head Office 10 New England 15 Mid Atlantic 20 South Atlantic 38 Great Lakes 42 Plains 51 Pacific 66 Mountain 84
By using an asterisk (*) you can select all the columns from the table. The next example lists all columns and rows from the ORG table:
SELECT * FROM ORG
This statement produces the following result:
DEPTNUMB DEPTNAME MANAGER DIVISION LOCATION -------- -------------- ------- ---------- ------------- 10 Head Office 160 Corporate New York 15 New England 50 Eastern Boston 20 Mid Atlantic 10 Eastern Washington 38 South Atlantic 30 Eastern Atlanta 42 Great Lakes 100 Midwest Chicago 51 Plains 140 Midwest Dallas 66 Pacific 270 Western San Francisco 84 Mountain 290 Western Denver