![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
hive
hive
Wuyikkk
这个作者很懒,什么都没留下…
展开
-
hive存储压缩与优化
一、习题--有哪些顾客连续两天来过我的店--先排号select *, row_number() over(partition by name order by orderdate) rnfrom business;--求日期相减select *, date_sub(orderdate, rn) tempfrom t1;--求连续两天来过的select name, count(*) cfrom t2group b原创 2021-02-17 15:26:20 · 130 阅读 · 0 评论 -
hive函数
一、常用函数--nvl空字段赋值select comm, nvl(comm, -1) from emp;--case when--统计不同部门男女各有多少人select dept_id, count(*) total, sum(case sex when '男' then 1 else 0 end) male, sum(case sex when '女' then 1 else 0 end) femalefrom emp_sexgroup by原创 2021-02-17 15:20:43 · 188 阅读 · 0 评论 -
hive之DML
一、基本查询--建立员工表create table if not exists emp(empno int,ename string,job string,mgr int,hiredate string, sal double, comm double,deptno int)row format delimited fields terminated by '\t';--建立部门表create table if not exists dept(deptno int,dname原创 2021-02-17 15:15:53 · 123 阅读 · 0 评论 -
hive之DDL
一、库的DDL--建库CREATE DATABASE [IF NOT EXISTS] database_name[COMMENT database_comment][LOCATION hdfs_path][WITH DBPROPERTIES (property_name=property_value, ...)];--例create database testcomment "Just for test"location '/test.db'with dbproperties("aaa原创 2021-02-17 15:04:53 · 99 阅读 · 0 评论