Logical operators and functions

Operator/FunctionDescription
! or notLogical not
<Less than
<=Less than or equal to
=Equal to
>Greater than
>=Greater than or equal to
^Bitwise exclusive or
|Bitwise or
~Bitwise not
arrays_overlapReturns the common elements
assert_trueAsserts if the expression is true
ifIf the expression evaluates to true, return the second expression. Otherwise, return the third expression.
ifnullIf the expression is null, it returns the second expression. Otherwise, it returns the first expression.
inReturns true if the first expression is in any of the subsequent expressions.
isnanReturns true if the value is not a number
isnotnullReturns true if the value is not null
isnullReturns true if the value is null
nanvlReturns the first expression if not a number, returns the second expression otherwise
orLogical or
whenWhen can be used to create branch conditions for comparison
xpath_booleanReturns true if the XPath expression evaluates to true or if a matching node is found

Date/time functions

FunctionDescription
add_monthsAdd months to date
date_addAdd days to date
date_formatModify date format
date_subSubtract days from date
date_truncReturns the date truncated to the specified unit
datediffReturns the difference between dates in days
day, dayofmonthReturns the day of the month
dayofweekReturns the day of week (1-7)
dayofyearReturns the day of year
from_unixtimeReturns date in UNIX® time
from_utc_timestampReturns date in UTC time
hourReturns the hour of the input
last_dayReturns the last day of the month that the date belongs to
minuteReturns the minute of the input
monthReturns the month of the input
months_betweenNumber of months between
next_dayReturns the first day later than the input
quarterReturns the quarter of the input
secondReturns the second of the string
to_dateConverts the string to a date. Note: The string must be in the format yyyy-mm-ddTHH24:MM:SS.
to_timestampConverts the string to a timestamp. Note: The string must be in the format yyyy-mm-ddTHH24:MM:SS.
to_unix_timestampConverts the string to a UNIX® timestamp
to_utc_timestampConverts the string to a UTC timestamp
truncTruncates the date
unix_timestampReturns the UNIX® timestamp
weekdayDay of the week (0-6)
weekofyearReturns the week of the year for a given date
yearReturns the year of the string