Home

SQL Keywords: SELECT

  

Introduction

The SELECT keyword is used to select one or more fields from a table. The primary formula to follow is:

SELECT What FROM WhatObject;

The What factor of our syntax can be the name of a column of a table or query. The WhatObject factor can be the name of a table or a query.

Here is an example that selects one field from a table:

SELECT LastName FROM Employees;

Here is an example that selects all fields from a table:

SELECT * FROM Employees;

Alternatively, you can precede the * with the ALL keyword. Here is an example:

SELECT ALL * FROM Employees;

Here is an example that selects a few fields from a table:

SELECT FirstName, LastName, HourlySalary
FROM Employees;

Here is an example that includes the name of a table in square brackets:

SELECT * FROM [Employees];

Here is an example that uses the period to qualify the name of each field from its table:

SELECT Employees.FirstName, Employees.LastName
FROM Employees;

Here is an example that delimits the name of each object in square brackets:

SELECT [Employees].[FirstName], [Employees].[LastName]
FROM [Employees];

See Also


Home Copyright © 2009-2016, FunctionX, Inc.