Download UnityJDBC User Manual

Transcript
Supported SQL Syntax
Date/Time Functions and Operators
The following are a few of the date functions supported. A complete list is on the website.
Table 6.5. Date Functions
Function
Return Type
Example
CURRENT_TIMESTAMP TIMESTAMP CURRENT_TIMESTAMP
Result
Description
2011-07-06
12:53:45
Returns the current
date. Format: "yyyyMM-dd HH:mm:ss"
CURRENT_TIME
TIME
CURRENT_TIME
12:53:45
Returns the current time.
Format: "HH:mm:ss"
CURRENT_DATE
DATE
CURRENT_DATE
2011-07-06
Returns the current date.
Format: "yyyy-MM-dd"
YEAR
INT
YEAR('2011-07-06)
2011
Returns the year of the
given date expression.
MONTH
INT
MONTH('2011-07-06)
7
Returns the month of the
given date expression.
DAY
INT
DAY('2011-07-06)
6
Returns the day of the
given date expression.
2006-07-06
12:53:45
Allows the addition of
a given date field to a
datetime expression.
Intervals are supported
and are translated as
necessary for systems
that do not support them.
DATEADD
TIMESTAMP DATEADD('2011-07-06',
INTERVAL 3 days)
Aggregate Functions
The following aggregate functions are supported:
Table 6.6. Aggregate Functions
Function
Argument
Type
Return Type
int, float,
double
precision type
int for integer types, double
precision for float/double types
count(*)
N/A
int
Count of number of input values
count(x)
any
int
Count of number of non-null input
values
group_concat(x)
any
varchar
Returns a comma-separated list of all
input values.
any
comparable
type
same as input
avg(x)
max(x)
61
Description
Average of all input values
Maximum of all input values