使用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';

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

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

相关命令:

start-all.sh

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

Hive

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

命令:select count(num) from class1;

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

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

命令:select count(num) from class2;

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

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

命令:select count(*) from class3;

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

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

命令:select count(*) from class4;

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

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

命令:select count(*) from class5;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

结束!

Original: https://blog.csdn.net/qq_58476985/article/details/128025379
Author: 墨染盛夏呀
Title: 使用hive进行大数据项目分析

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/817159/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球