Select clause
- Last Updated: July 30, 2025
- 2 minute read
- DataDirect Connectors
- ODBC
- Salesforce 8.0
- Documentation
Purpose
Use the Select clause to specify with a list of column expressions that identify columns of values that you want to retrieve or an asterisk (*) to retrieve the value of all columns.
Syntax
SELECT [{LIMIT offsetnumber | TOP number}] [ALL | DISTINCT] {* | column_expression [[AS] column_alias] [,column_expression [[AS] column_alias], ...]}
where:
-
LIMIToffset number - creates the result set for the Select statement first and then discards the
first number of rows specified by
offsetand returns the number of remaining rows specified by number. To not discard any of the rows, specify0foroffset, for example,LIMIT 0number. To discard the first offset number of rows and return all the remaining rows, specify0for number, for example,LIMIToffset0. -
TOPnumber - is equivalent to
LIMIT 0number. -
column_expression - can be simply a column name (for example,
last_name). More complex expressions may include mathematical operations or string manipulation (for example,salary * 1.05). See "SQL expressions" for details.column_expressioncan also include aggregate functions. See Aggregate Functions" for details. -
column_alias - can be used to give the column a descriptive name. For example, to assign the alias department to the column dep:
-
DISTINCT - eliminates duplicate rows from the result of a query. This operator can precede the first column expression. For example:
Notes
- Separate multiple column expressions with commas (for example,
SELECT last_name, first_name, hire_date). - Column names can be prefixed with the table name or table alias. For
example,
SELECT emp.last_name or e.last_name, whereeis the alias for the tableemp. - NULL values are not treated as distinct from each other. The default
behavior is that all result rows be returned, which can be made explicit with the keyword
ALL.