function_ref:
aggregate_fcn | scalar_fcn
aggregate_fcn:
calc_fcn_name ( [DISTINCT] arith_expr )
| COUNT{* | column_var })
| {EVERY | ANY | SOME} ( conditional_expr )
| {MIN | MAX | INVAR} (value_expr)
| agg_udf_name( [DISTINCT] value_expr)
calc_fcn_name:
SUM | AVG | VAR_SAMP | VAR_POP | STDDEV_SAMP | STDDEV_POP
scalar_fcn:
IF (conditional_expr, value_expr1, value_expr2)
| numeric_function | datetime_function | string_function | misc_function
| scalar_udf_name (value_expr1[, value_expr2]...)
numeric_function:
abs(arith_expr)
| acos(arith_expr)
| asin(arith_expr)
| atan(arith_expr)
| atan2(arith_expr1, arith_expr2)
| {ceil | ceiling}(arith_expr)
| cos(arith_expr)
| cot(arith_expr)
| degrees(arith_expr)
| exp(arith_expr)
| floor(arith_expr)
| {ln | log}(arith_expr)
| mod(arith_expr1, arith_expr2)
| pi()
| power(arith_expr1, arith_expr2)
| rand(num)
| round(arith_expr)
| sign(arith_expr)
| sin(arith_expr)
| sqrt(arith_expr)
| tan(arith_expr)
datetime_function:
age(dt_expr)
| {curdate | current_date}()
| {curtime | current_time}()
| {curts | current_timestamp}()
| dayofmonth(dt_expr)
| dayofweek(dt_expr)
| dayofyear(dt_expr)
| hour(dt_expr)
| minute(dt_expr)
| month(dt_expr)
| quarter(dt_expr)
| second(dt_expr)
| trunctime (dt_expr, tt_spec)
| week(dt_expr)
| year(dt_expr)
string_function:
ascii(string_expr)
| CHAR(num)
| {char_length | character_length}(string_expr)
| CONCAT(left_string_expr, right_string_expr)
| CONVERT(value_expr, {convert_type | { | WCHAR}, width_num, convert_format})
| insstr(target_string_expr, offset_num, count_num, replacement_string_expr)
| lcase(string_expr)
| left(string_expr, count_num)
| length(string_expr)
| locate(match_string_expr, search_string_expr, startpos_num)
| ltrim(string_expr)
| octet_length(string_expr)
| position(match_string_expr, search_string_expr)
| repeat(string_expr, count_num)
| replace(string_expr, string_expr, string_expr)
| right(string_expr, count_num)
| rtrim(string_expr)
| substring(string_expr, startpos_num, length_num)
| trim(num, string_expr, string_expr)
| ucase(string_expr)
| unicode(string_expr)
| WCHAR(num)
misc_function:
DATABASE()
| COALESCE(value_expr1, value_expr2, value_exprN)
| ROWNUMBER()
| IFNULL(value_expr1, value_expr2)
| TYPEOF(value_expr)
tt_spec:
"1S" | "5S" | "10S" | "15S" | "20S" | "30S" | "1M" | "5M"
| "10M" | "15M" | "20M" | "30M" | "1H" | "3H" | "4H"
| "6H" | "8H" | "12H"
convert_type:
CHAR | TINYINT | SMALLINT | INTEGER | BIGINT | REAL | DATE | TIME | TIMESTAMP
convert_format:
numeric_format | datetime_format
numeric_format:
"[<< | >> | ><]['text' | $][- | (][#,]#[.#[#]...][e | E]['text' | $ | %]"
datetime_format:
"[<< | >> | ><]['text' | spchar | date_code | time_code]..."
date_code:
m | mm | mmm | mon | mmmm | month
| d | dd | ddd | dddd | day
| yy | yyyy
time_code:
h | hh | m | mm | s | ss | .f[f]... | [a/p | am/pm | A/P | AM/PM]