String Value Expressions
Resulting Data Types
SAND CDBMS follows the SQL92 standard in regards to the data types returned by arithmetic and aggregate operations, except in the following cases:
- SUM ([DISTINCT] expression) an INTEGER or SMALLINT expression returns DECIMAL (20,0).
- AVG ([DISTINCT] expression) an INTEGER or SMALLINT expression returns FLOAT.
- SMALLINT arithmetic an INTEGER value is returned by SMALLINT addition, subtraction, and multiplication. That is:
- SMALLINT + SMALLINT = INTEGER
- SMALLINT - SMALLINT = INTEGER
- SMALLINT * SMALLINT = INTEGER
- INTEGER-SMALLINT division an INTEGER value is returned if an INTEGER or SMALLINT value is the divisor and dividend, apart from SMALLINT divided by SMALLINT. That is:
- INTEGER / INTEGER = INTEGER
- INTEGER / SMALLINT = INTEGER
- SMALLINT / INTEGER = INTEGER