<< Click to Display Table of Contents >> Navigation: Data Module > Import & export > Data mappings > SQL Basics > Keywords > SELECT |
Specifies the columns to be returned by the query.
Syntax
SELECT [ ALL | DISTINCT ]
[ TOP n ]
< select_list >
< select_list > ::=
{ *
| { table_name }.*
| { column_name | expression }
[ [ AS ] column_alias ]
| column_alias = expression
} [ ,...n ]
Arguments
ALL
Specifies that duplicate rows can appear in the result set. ALL is the default.
DISTINCT
Specifies that only unique rows can appear in the result set. Null values are considered equal for the purposes of the DISTINCT keyword.
TOP n
Specifies that only the first n rows are to be output from the query result set. n is an integer between 0 and 4294967295. PERCENT is not supported.
< select_list >
The columns to be selected for the result set. The select list is a series of expressions separated by commas.
*
Specifies that all columns from all tables in the FROM clause should be returned. The columns are returned by table as specified in the FROM clause, and in the order in which they exist in the table.
table_name.*
Limits the scope of the * to the specified table.
column_name
Is the name of a column to return. Qualify column_name to prevent an ambiguous reference, such as occurs when two tables in the FROM clause have columns with duplicate names.
expression
Is a column name, constant, function, any combination of column names, constants, and functions connected by an operator(s), or a sub-query.
column_alias
Is an alternative name to replace the column name in the query result set. Aliases are used also to specify names for the results of expressions, for example:
SELECT AVG(Price) AS 'Average Price' FROM Product