SELECT Statement

Use SQL's SELECT statement to view information in the database. You can see the values of all fields for an entry or you can see a specified subset.

Note: You can also use SELECT statements to view data from more than one table. See your SQL documentation for information about JOIN statements.

Syntax

At its most basic, the syntax for the SELECT statement is as follows:

SELECT <field-name-1>[, <field-name-2>] ...
FROM tablename

where

field-name represents a column or columns in tablename.

tablename is the name of the database table.

Example

For example, the statement

SELECT C_FIRST_NAME, C_LAST_NAME FROM CUSTOMER

returns the first and last names of customers listed in the customer table:

ACUSQLUSGU04-low.gif