SQL Statements and Extensions for the Salesforce Driver : Select : Select Clause

Select Clause
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], ...]}
[INTO [DISK | TEMP] new_table]
where:
LIMIT offset number
Creates the result set for the Select statement first and then discards the first number of rows specified by offset and returns the number of remaining rows specified by number. To not discard any of the rows, specify 0 for offset, for example, LIMIT 0 number. To discard the first offset number of rows and return all the remaining rows, specify 0 for number, for example, LIMIT offset0.
TOP number
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_expression can 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:
SELECT dep AS department FROM emp
DISTINCT
Eliminates duplicate rows from the result of a query. This operator can precede the first column expression. For example:
SELECT DISTINCT dep FROM emp
INTO
Copies the result set into new_table. INTO DISK creates the new table in cached memory. INTO TEMP creates a temporary table.
Notes
Column names can be prefixed with the table name or table alias. For example, SELECT emp.last_name or e.last_name, where e is the alias for the table emp.
Aggregate Functions
From Clause
Where Clause
Group By Clause
Having Clause
Union Operator
Intersect Operator
Except and Minus Operators
Order By Clause
Limit Clause

© 2013 Progress Software Corporation and/or its subsidiaries or affiliates.