使用hive进行大数据项目分析

目录

一、首先要创建表:在txt记事本中先输入创建语句备用,创建class1~class5的表。

二、启动hadoop集群,MySQL,hive。

三、创建数据库zhh,用户为zhh,之后将之前写在txt记事本里的创建表class1~class5的命令复制到hive当中:

四、将txt里的数据上传到/data/zhh/class1(class1~class5依次进行)

五、相关大数据分析要求:


一、首先要创建表:在txt记事本中先输入创建语句备用,创建class1~class5的表。

create table class5(

num String comment'this is the xuhao of students',

xuehao String comment 'this is the xuehao of students',

name String comment 'this is the name of student',

banji String comment 'this is the banji of students',

kqbxcj String comment 'this is the kaoqinbiaoxianchengji of students',

pszycj String comment 'this is the pingshizuoyechengji of student',

qimocj String comment 'this is the qimochengji of student',

zhcj String comment'this is the zonghechengji of students'

)

row format delimited fields terminated by ',' stored as textfile

location '/data/zhh/class5';

二、启动hadoop集群,MySQL,hive。

相关命令:

start-all.sh

mysql5.7/support-files /mysql.server start

Hive

三、创建数据库zhh,用户为zhh,之后将之前写在txt记事本里的创建表class1~class5的命令复制到hive当中:

四、将txt里的数据上传到/data/zhh/class1(class1~class5依次进行)

命令:hdfs dfs -put class01.txt  /data/zhh/class

五、相关大数据分析要求:

1、查询2019级1班ETL技术期末考试的综合分数80分以上的学生信息(含80分)。

命令:select *from class1 where zhcj>=80;

2、查询2019级1班ETL技术期末考试考试成绩90分以上的学生信息(含90分)。

 命令:select *from class1 where qimocj>=90;

3、统计2019级1班ETL技术期末考试成绩70分以上的学生人数(含70分)

命令:select count(*) from class1 where qimocj>=70;

4、统计2019级2班ETL技术期末考试成绩及格的学生人数。

命令:select count(*) from class2 where qimocj>=60;

5、统计2019级1班参加ETL技术考试的学生总人数(序号数即为人数则课使用num为关键字查询)

命令:select count(num) from class1;

 

6、统计2019级2班参加ETL技术考试的学生总人数。

命令:select count(num) from class2;

7、统计2019级3班参加ETL技术考试的学生总人数。

命令:select count(*) from class3;

8、统计2019级4班参加ETL技术考试的学生总人数。

命令:select count(*) from class4;

9、统计2019级数据科学与大数据技术全年级的学生总人数。

命令:select count(*) from class5;

10、查询2019级全年级ETL技术的期末考试成绩80分及以上的学生信息。

命令:select * from class5 where qimocj>=80;

11、查询2019级全年级ETL技术的期末综合成绩85分及以上的学生信息。

命令:select * from class5 where qmcj>=85;

12、统计2019级全年级ETL技术的期末综合成绩86分及以上的学生的总人数。

命令:select count(zhcj>=86) from class5 ;

13、查询2019级数据科学与大数据技术1班吉苇同学的学号、以及所有成绩。

命令:select xuehao,name,kqbxcj,qimocj,zhcj from class1 where name=”吉苇”;

14、查询2019级数据科学与大数据技术2班彭艳同学的学号、以及所有成绩。

命令:select xuehao,name,kqbxcj,qimocj,zhcj from class2 where name=”彭艳”;

15、统计2019级1班ETL技术的期末综合成绩不及格的学生人数。

命令:select count(*) from class1 where zhcj>=60;

16、统计2019级全年级ETL技术的期末综合成绩不及格的学生人数。

命令:select count(*) from class5 where zhcj<60;

17、分析出2019级全年级ETL技术的期末考试成绩分布在70-85分之间的学生信息。

命令:select * from class5 where qimocj between 70 and 85;

18、分析出2019级1班ETL技术的期末考试成绩分布在70-79分之间的学生信息。

命令:select * from class1 where qimocj between 70 and 79;

19、分析出2019级2班ETL技术的期末考试成绩分布在60-69分之间的学生信息。

命令:select * from class2 where qimocj between 60 and 69;

20、统计2019级数据科学与大数据技术全年级学生的期末综合成绩80分以上的学生人数(含80分)。

命令:select count(*) from class5 where qimocj>=80;

结束!

  • 4
    点赞
  • 49
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 6
    评论
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

墨染盛夏呀

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值