Arithmetic Expressions
Open SQL for Java
supports the full range of arithmetic expressions defined by entry SQL
level in statements.
Syntax
<arithmetic
expression> ::=
<term>
| <value expression> (
'+' | '-' ) <term>.
<term> ::= <factor> |
<term> ( '*' | '/' ) <factor>.
<factor> ::= ( '+' | '-' )? < primary>.
< primary> ::= <column reference>
| <literal>
| <set function>
| '(' <value expression> ')'.
|
Example
SELECT employee_name, salary +
benefit
FROM employees
WHERE salary < 0.8 *
( SELECT MAX( salary ) FROM employees )
|
Arithmetic
Expressions. For
all employees that have a salary not exceeding 80% of the salary of the
maximum salary of all employees, this query returns the name of the employee
and the sum of its salary and its benefit.
More Information
Column References
Literals
Set Functions
Value expressions