培训系列16--hive 的条件语句和聚合函数

一。条件表达

case when ... then when .... then ... when ... then ...end

select film_id,rpad(title,20," "),case when rating in ("G","PG","PG-13") then "YOUNG" WHEN RATING=="NC-17" THEN "17 AND UP" WHEN RATING="R" THEN "Mature" else "Unrated" end from film;

isnull() 函数


nvl(field ,field/date)
函数如果是空的话用后面的数据或者另外一个字段填空

二聚合函数

猜你喜欢

转载自www.cnblogs.com/davidzhu/p/10110141.html
今日推荐