(一)聚合函数
1、count 个数统计函数: count(*)
2、sum 总和统计函数:sum(score)
3、max 最大值统计函数:max(score)
4、min 最小值统计函数:min(score)
5、avg 平均值统计函数:avg(score)
(二)窗口函数
1、rank 考虑分组内数据的重复性,重复的会挤占后续的标号:
rank() over(partition by col1 order by col2
2、row_number 不考虑分组内数据的重复性
row_number() over(partition by col1 order by col2)
3、dense_rank 考虑分组内数据的重复性 重复的不会挤占后续的标号:
dense_rank() over(partition by col1 order by col2
(3)日期函数
1、unix_timestamp 获取当前UNIX时间戳函数:select unix_timestamp()
2、from_unixtime 日期函数UNIX时间戳转日期函数: from_unixtime(bigint unixtime[, string format])
3、unix_timestamp 日期转UNIX时间戳函数: unix_timestamp(string date, string pattern)
4、to_date 日期时间转日期函数:to_date(string timestamp)
select to_date(‘2019-06-28 16:02:03’)
5、datediff 日期比较函数:datediff(string enddate, string startdate)
select datediff(‘2019-06-28’,‘2019-05-28’)