SELECT Statement (SQL Only)

See AlsovbhowSQLSELECTSee                 ExamplevbhowSQLSELECTEx>Low


SELECT specifies which fields you want to retrieve.  You use the FROM clause to indicate which tables contain those fields.  You use the WHERE clause to indicate which records are to be retrieved.


         SELECT is usually the first word in an SQL statement.

         If you include more than one field, separate the field names with commas.  List the fields in the order you want them to be retrieved.

         If a field name appears in more than one table listed in the FROM clause, precede the field name with the table name and the . (dot) operator.  In the following example, the AU_ID field is in both the Authors table and the Titles table.  The SQL statement selects the Title field from the Titles table and the Author field from the Authors table.

  SELECT Titles.Title.Dept, Author
  FROM Titles, Authors
  WHERE Titles.AU_ID = Authors.AU_ID


         You can use an asterisk (*) to select all fields in a table.  The following example selects all of the fields in the Publishers table.

  SELECT Publishers.* FROM Publishers


         You can use the AS reserved word to create an alias for a field name.  The following example uses the Year for the field name.

  SELECT [Year Published] AS Year
  FROM Titles


         When you use a field name that contains a space or punctuation, surround the name with brackets:

  SELECT [Year Published], Title
  FROM Titles