您当前的位置: 首页 >  大数据

段智华

暂无认证

  • 2浏览

    0关注

    1232博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

大数据Spark “蘑菇云”行动第88课:Hive脚本、常用命令、having查询及变种实战

段智华 发布时间:2016-11-29 21:27:40 ,浏览量:2

大数据Spark “蘑菇云”行动第88课:Hive脚本、常用命令、having查询及变种实战

HiveScript.sql的脚本内容

show databases; use default; show tables; select * from employees; hive> !pwd hive> ! /bin/echo "Hive on spark!" hive> dfs -ls /

  # hive -s -e "select * from employee" >> /usr/local/test.log # hive  -e "select * from employee"   hive -S -e "set" | grep warehouse

desc employee; select name from (select name,sum(salary) as salarytotal from employee)

employeeforhaving加一个字段 性别 男、女 create  table employeeforhaving (userid int, name string,address string,salary double,gender string)  ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n'"); load data local inpath '/..../employee.txt int tables‘ employeeforhaving; select gender form(select gender,sun(salary) as salarytotal from employeesforhaving group by gender ) subquery where  subquery.salarytotal >30000 SELECT  gender ,SUM(salary) FROM employeesforhaving GROUP BY  gender  HAVING SUM(salary)> 30000

关注
打赏
1659361485
查看更多评论
立即登录/注册

微信扫码登录

0.1298s