SAND CDBMS SQL Reference Guide
Value Expressions

 

Previous Topic:
Date/Time Functions
Chapter Index
Next Topic:
String Value Expressions

 

Numeric Value Expressions


A numeric value expression is an expression that evaluates to a number using some combination of direct references to numeric columns, numeric literals, and aggregate or math functions.

The following arithmetic operators can be used  to perform computations in numeric value expressions, in conjunction with positive or negative (signed) numeric value expression primaries (as described here).

+    (addition)
-    (subtraction)
*    (multiplication)
/    (division)

Arithmetic operators are evaluated within an expression from left to right, in the following order of precedence:

1. Unary Plus ( + ) and Minus ( - )
2. Multiplication ( * ) and Division ( / )
3. Addition ( + ) and Subtraction ( - )

Parentheses may be employed, however, to override the order of evaluation.  Expressions within parentheses are evaluated before other parts of the expression. Within a level of precedence, operations are performed in order from left to right. Expressions that use arithmetic operators require numeric operands, and always produce numeric values.