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


    目录

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

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

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

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

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


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

    1. create table class5(
    2. num String comment'this is the xuhao of students',
    3. xuehao String comment 'this is the xuehao of students',
    4. name String comment 'this is the name of student',
    5. banji String comment 'this is the banji of students',
    6. kqbxcj String comment 'this is the kaoqinbiaoxianchengji of students',
    7. pszycj String comment 'this is the pingshizuoyechengji of student',
    8. qimocj String comment 'this is the qimochengji of student',
    9. zhcj String comment'this is the zonghechengji of students'
    10. )
    11. row format delimited fields terminated by ',' stored as textfile
    12. 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;

    结束!

  • 相关阅读:
    算法——动态规划
    大模型创业“风投”正劲,AGI Foundathon 大模型创业松活动精彩看点
    facebook引流软件需要具备什么功能
    基于RuoYi-Flowable-Plus的若依ruoyi-nbcio支持部门经理的审批
    计算机组成原理 期末复习笔记
    【Linux基础】Linux的基本指令使用(超详细解析,小白必看系列)
    JD关键词api
    JVM学习六
    LLEETCODE力扣详解:4.寻找两个正序数组的中位数;5.最长回文子串
    【flask扩展】使用Flask-Mail发送邮件
  • 原文地址:https://blog.csdn.net/qq_58476985/article/details/128025379