background image
<< MIN function | RANDOM function >>

MONTH function

<< MIN function | RANDOM function >>
Derby Reference Manual
135
SELECT * FROM flights
WHERE HOUR(departure_time) = 6 and MINUTE(departure_time) < 31;
MOD function
MOD returns the remainder (modulus) of argument 1 divided by argument 2. The result is
negative only if argument 1 is negative.
Syntax
mod(integer_type, integer_type)
The result of the function is:
· SMALLINT if both arguments are SMALLINT.
· INTEGER if one argument is INTEGER and the other is INTEGER or SMALLINT.
· BIGINT if one integer is BIGINT and the other argument is BIGINT, INTEGER, or
SMALLINT.
The result can be null; if any argument is null, the result is the null value.
MONTH function
The MONTH function returns the month part of a value.
The argument must be a date, timestamp, or a valid character string representation of
a date or timestamp that is not a CLOB, LONG VARCHAR, or XML value. The result of
the function is an integer between 1 and 12. If the argument can be null, the result can be
null; if the argument is null, the result is the null value.
Syntax
MONTH ( expression )
Example
Select all rows from the EMPLOYEE table for people who were born (BIRTHDATE) in
DECEMBER.
SELECT * FROM EMPLOYEE WHERE MONTH(BIRTHDATE) = 12
NULLIF expressions
Use the NULLIF expressions for conditional expressions in Derby.
NULLIF expression syntax
NULLIF ( L, R )
The NULLIF expression is very similar to the CASE expression. For example,
NULLIF(V1,V2)
is equivalent to the following CASE expression:
CASE WHEN V1=V2 THEN NULL ELSE V1 END
PI function
The PI function returns a value that is closer than any other value to pi.
The constant pi is the ratio of the circumference of a circle to the diameter of a circle.