SAND CDBMS SQL Reference Guide
SELECT

 

Previous Topic:
Select List Clause
Chapter Index
Next Topic:
Table Expression Clause

 

Value Expression Clause


column name

This specifies a table or view column from which data values are to be retrieved by the query. When selecting from two or more tables that have duplicate column names, qualify the column names with their table, view, or correlation names to ensure that the correct values are retrieved. If the column name is qualified by the name of a table or view in another schema, qualify the table name with the name of the schema.

function
The function argument can be an aggregate function (also known as a set or column function), a cast function, a string function, a math function, or a date function. The function is applied to a value expression argument, producing a column or derived column as its result. Consult the Functions section for a description of the available functions.

Any columns (or expressions containing columns) appearing in a select list that includes aggregate functions must be included in a GROUP BY clause. When a SELECT statement is structured in this way, the aggregate function is applied to produce a separate value for each distinct combination of values from the GROUP BY columns.

The ALL keyword tells the function to consider all the non-null entries in the column, satisfying a WHERE clause condition. ALL is the default option, so FUNCTION (ALL column-name) and FUNCTION (column-name) are equivalent. The DISTINCT keyword tells the function to consider only distinct non-null records. The DISTINCT option keyword may only be used once in a SELECT clause.

constant
A numeric or string constant can also be specified in the SELECT list. The effect on the output table is a column where the constant is the value for each row in that column. This might, for example, be useful in labeling the output. String literals must be contained between single quotes.

( scalar subquery )
A complete SELECT statement that returns a single value. If more than one row is returned by this subquery, an error will be generated and the outer query will fail. If the subquery result set is empty, a null value is returned. The entire scalar subquery must be contained in parentheses.

expression operators
The + (addition), - (subtraction), * (multiplication), and / (division) operators are used to construct arithmetic expressions. The || (concatenation) operator is used to append one string value expression to the end of another.