Show TOC

Syntax documentationArithmetic Expressions Locate this document in the navigation structure

Open SQL for Java supports the full range of arithmetic expressions defined by entry SQL level in statements.

Syntax

Syntax Syntax

  1. <arithmetic expression> ::= 
                  <term> 
                  | <value expression> ( '+' | '-' ) <term>.
    
    <term> ::= <factor> | 
                  <term> ( '*' | '/' ) <factor>.
    
    <factor> ::= ( '+' | '-' )? < primary>.
    
    < primary> ::= <column reference> 
                        | <literal> 
                        | <set function> 
                        | '(' <value expression> ')'.
    
End of the code.
Example

Example Example

  1. SELECT employee_name, salary + benefit 
                   FROM employees 
                   WHERE salary < 0.8 * 
                      ( SELECT MAX( salary ) FROM employees )
    
End of the code.

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.