The basic statement for retrieving data from a table is SELECT. SELECT specifies which data you want to retrieve. The FROM clause in the SELECT statement specifies which table holds the data.
How It's Done
The DEPARTMENT table contains the following columns:
In order to list all information about each department, you need to access this table and select all columns. To do this, enter:
select *
from department;
You can enter this statement all on one line or spanning several lines. You can use either lowercase or uppercase.
What does the asterisk (*) mean?
It means that you want to see all the columns in the table. You don't have to list the column names explicitly.
What does DEPARTMENT indicate?
It's the name of the table from which you want to access data.
Why is there a semicolon at the end of the statement?
SQL will not process an interactive statement until it encounters a semicolon.
What You See
The result looks like this:
OCF nn.n ONLINE IDMS NO ERRORS SELECT * FROM DEPARTMENT; *+ *+ DEPT_ID DEPT_HEAD_ID DIV_CODE DEPT_NAME *+ ------- ------------ -------- --------- *+ 1120 2004 D06 PURCHASING - SERVICE *+ 4200 1003 D04 LEASING - NEW CARS *+ 4900 2466 D09 MIS *+ 2210 2010 D04 SALES - NEW CARS *+ 3520 3769 D04 APPRAISAL NEW CARS *+ 5000 2466 D09 CORPORATE ACCOUNTING *+ 4500 3222 D09 HUMAN RESOURCES *+ 4600 2096 D06 MAINTENANCE *+ 2200 2180 D02 SALES - USED CARS *+ 5100 2598 D06 BILLING *+ 6200 2461 D09 CORPORATE ADMINISTRATION *+ 3530 2209 D06 APPRAISAL - SERVICE *+ 6000 1003 D09 LEGAL *+ 3510 3082 D02 APPRAISAL - USED CARS *+ 1100 2246 D02 PURCHASING - USED CARS *+ *+ 17 rows processed
Rows Are Not Ordered
There is no inherent order to the rows as they are stored in the database. The rows in your result, therefore, may be in a different order from those displayed here. The message specifying the number of rows returned may be worded differently and appear in a different position on your screen.
|
Copyright © 2014 CA.
All rights reserved.
|
|