内置函数





//第一列除以第二列 取模
hive> select pmod(1,2);
//四舍五入
select round(3.1344);

hive> select pmod(sal,2) from emp;

 

//创建表  人名  分数 

hive> create table sc(name string,scores Array<int>) row format delimited fields terminated by " " collection items terminated by ",";

zhangsan 98,99,69,39
lisi 68,23,87,90

hive> load data local inpath "/sc.txt" into table sc;

 

 

 

 

//两个时间差

 

//工作了多久

 

 

 ===============================================================================================================================

 

 

hive> select ename,year(current_date)-year(hiredate) from emp;

 ==================================

select current_timestamp;

 hive> select unix_timestamp();

 //当前时间 ——+ 5 天

///当前时间 —— -5 天

 ================================================================

 

 

 

 

posted @ 2019-05-14 15:36  lilixia  阅读(157)  评论(0编辑  收藏  举报