abs:绝对值
select abs(-5);
array:用给定的元素创建一个数组
select array('1','ad','aa','2021-10-07');
array_contains:如果数组包含返回true,否则false
select array_contains(array('a','b','c'),'e');
ascii:返回参数第一个字符的ASCII
select ascii('string');
avg:平均值
select avg(x);
bin:以二进制形式返回参数
select bin(3);
cbrt:返回双精度值得立方根
select cbrt(8);
ceil:返回大于等于参数得最小整数
select ceil(1.2);
select ceiling(0.2);
coalesce:返回第一个非空参数
select coalesce(1,null);
select coalesce(null,1);
select coalesce(null,null,1);
collect_list:返回具有重复项的集合
select collect_list(x);
collect_set:返回消除了重复项的集合
select collect_set(x);
concat:将参数连接起来
select concat('a','=','1');
concat_ws:返回由分隔符分隔的参数得串联
select concat_ws(',',array('a=1','b=2','c=3'));
count:计算行数
select count(*);
current_database:返回当前使用的数据库名称
select current_database();
时间相关
--current_date:返回当前日期
select current_date();
--current_timestamp:返回当前的时间戳
select current_timestamp();
--add_months:加减月份
select add_months('2021-10-07',-2);
select add_months('2021-10-07',1);
--date_add:加日期
select date_add('2021-10-07',-1);
--date_sub:减日期
select date_sub('2021-10-07',2);
--date_format:将日期、时间戳、字符串格式化为指定的格式
select date_format(current_timestamp(),'yyyyMMdd');
--datediff:日期相减,返回日期1与日期2之间的天数
select datediff('2021-10-08','2021-10-01');
--dayofmonth:返回日期、时间戳中的日