CAST expression
Derby Reference Manual
89
Expression Type
Explanation
Allowed anywhere in an expression where the data type
can be easily deduced. See
.
CAST expression
Lets you specify the type of NULL or of a dynamic
parameter or convert a value to another type. See
.
Scalar subquery
Subquery that returns a single row with a single column.
See
.
Table subquery
Subquery that returns more than one column and more
than one row. See
.
Allowed as a tableExpression in a FROM clause and with
EXISTS, IN, and quantified comparisons.
Conditional expression
A conditional expression chooses an expression to
evaluate based on a boolean test.
Boolean expressions
Boolean expressions are expressions that result in boolean values. Most general
expressions can result in boolean values. Boolean expressions commonly used in a
WHERE clause are made of operands operated on by SQL operators (see
SQL Boolean
operators
for a table of SQL operators).
Numeric expressions
Numeric expressions are expressions that result in numeric values. Most of the general
expressions can result in numeric values. Numeric values have one of the following
types:
· BIGINT
· DECIMAL
· DOUBLE PRECISION
· INTEGER
· REAL
· SMALLINT
The following table lists the types of numeric expressions.
Table 3.
Numeric expressions
Expression Type
Explanation
+, -, *, /, unary + and -
expressions
Evaluate the expected math operation on the
operands. If both operands are the same type,
the result type is not promoted, so the division
operator on integers results in an integer that is the
truncation of the actual numeric result. When types
are mixed, they are promoted as described in
Unary + is a noop (i.e., +4 is the same as 4).
Unary - is the same as multiplying the value by -1,
effectively changing its sign.
AVG
Returns the average of a set of numeric values.
SUM