Progress
SQL-92
Guide and Reference
Expressions
An expression is a symbol or string of symbols used to represent or calculate a single value in a SQL statement. When you specify an expression in a statement, SQL retrieves or calculates the value represented by the expression and uses that value when it executes the statement. Expressions are also called scalar expressions or value expressions.
This is the syntax for an expression (expression):
[ table_name.| alias.]
column_name
Specifies a column in a table. You can qualify a column name with the name of the table or the alias it belongs to.
character_literal
| numeric_literal | date_time_literalSpecify constant values. See the "Literals" section for information on specifying literals.
aggregate_function
|scalar_function
SQL functions. See "SQL-92 Functions" for more information on “Aggregate Functions” and “Scalar Functions.”
numeric_arith_expr
Computes a value from numeric values. See "Numeric Arithmetic Expressions" for more information.
date_arith_expr
Computes a value from date-time values. See "Date Arithmetic Expressions" for more information.
conditional_expr
Evaluates a search condition or expression and returns one of multiple possible results depending on that evaluation.
(expression)
SQL evaluates expressions in parentheses first.
EXAMPLESThe following example illustrates specifying a table name for the customer_id field:
You must qualify a column name if it occurs in more than one table specified in the FROM clause:
NOTES
- Qualified column names are always permitted, even when they are not required.
- You can also qualify column names with an alias. An alias is also called a correlation name.
- The
FROM
clause of a query expression can specify an optional alias after the table name See the "Query Expressions" section for details on query expressions. If you specify an alias, you must use it, and not the table name, to qualify column names that refer to the table. Query expressions that join a table with itself must use aliases to distinguish between references to column names.The following example shows a query expression that joins the table customer with itself. It uses the aliases
x
andy
and returns information on customers in the same city as customer SMITH:
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |