For this example, we will use a REPORT table, into which has been loaded reports submitted by all departments, by title, author, and reference filename. A three character department code is used, defined in long form in another DEPARTMENT table.
To retrieve the columns you want displayed, indicate the column names
after the keyword SELECT
. The order in which the column names appear
after the SELECT
clause is the order in which these columns will be
displayed.
Example: Let's retrieve a list of all report titles.
If you enter the statement:
SELECT TITLE
FROM REPORT ;
The result displayed on the screen will be:
TITLE Innovations in Disappearing Ink Disappearing Ink Promotional Campaign Advertising Budget for 4Q 92 Improvements in Round Widgets Target Market for Colored Paperclips Ink Color Panorama Departmental Meeting Schedule |
The column name is automatically used as the column heading.
The first line in the SELECT
statement indicates the column name TITLE
is to be displayed. The second line indicates that TITLE is found in
the REPORT table.
Example:
If you want to display report titles, authors, and department, you
must specify that information in the SELECT
clause.
If you enter the statement:
SELECT TITLE, AUTHOR, DEPT
FROM REPORT ;
where each column name is separated from the next by a comma, and
columns are displayed in the order you specify in the SELECT
clause,
the result displayed on the screen will be:
TITLE AUTHOR DEPT Innovations in Disappearing Ink Jackson, Herbert RND Disappearing Ink Promotional Campaign Sanchez, Carla MKT Advertising Budget for 4Q 92 Price, Stella FIN Improvements in Round Widgets Smith, Roberta RND Target Market for Colored Paperclips Aster, John A. MKT Ink Color Panorama Jackson, Herbert RND Departmental Meeting Schedule Barrington, Kyle MGT |