Fieldlist


This part of the SELECT or INSERT INTO statement specifies the returned data columns.

Syntax:

 table.* | [table.|tablealias.]field [AS alias][,
   [table.|tablealias.]field [AS alias][, ...]]

Example usage:

 SELECT DISTINCT 
  Contact.LastName AS Last, 
  FirstName AS First
 FROM Contact

The parts of the fieldlist clause have the following meaning:
Part Meaning
table The source table from which the data is retrieved
tablealias An alias, within the query, for the source table. This is normally used when a table is joined with itself.
field The field containing the data
alias The column heading in the returned table

Example of table aliasing:

 SELECT DISTINCT A.Name AS Manager, B.Name AS Subordinate
 FROM Payroll A, Payroll B
 WHERE A.ID = B.SupervisorID

[Return to SQL Syntax]