


下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、第1关:计算每个班的语文总成绩和数学总成绩禁止修改drop database if exists mydb cascade;禁止修改begin 创建mydb数据库create database if not exists mydb;使用mydb数据库use mydb;创建表scorecreate table if not exists score (name string comment 姓名,Chinese string comment 语文成绩,maths string comment 数学成绩)row format delimited fields terminated bystored
2、 as textfile;导入数据:/root/data/stepl_flies/load data local inpath J/root/data/stepl_filesZ, into table score;创建表classcreate table if not exists class (stuname string comment 姓需 classname string comment 所在班级)row format delimited fields terminated bystored as textfile;导入数据:/root/data/stepl_flies/load da
3、ta local inpath /root/d3ta/stepl_files/ into table class;-计算每个班的语文总成绩和数学总成绩,要求有哪科低于60分,该名学生成绩不计入计 算。select ,from(select classname, sum Chinesefrom class c,score swhere = and =60group by tl,(select classname, sum mathsfrom class c,score swhere = and =60group by t2where =;end 第2关:査询选修了 3门以上的课程的学生姓名 禁止
4、修改drop database if exists mydb cascade;禁止修改begin 创建mydb数据库create database if not exists mydb;一-使用mydb数据库use mydb;创建表my_stucreate table if not exists my_stu(id string comment 学生 id,,name string comment 学生姓洛,sex string comment 性别,age string comment 年龄,col string comment 所选的系)row format delimited field
5、s terminated bystored as textfile;导入数据:/root/data/step2_files/load data local inpath J/root/data/step2_filesZ, into table my_stu;创建表my_scorecreate table if not exists my_score(id string comment 学生 id,,courseid string comment 课程 id,score string comment 成绩)row format delimited fields terminated by ,st
6、ored as textfile;导入数据:/root/data/step2_files/load data local inpath /root/data/step2_files/ into table my_score; 创建表 my_coursecreate table if not exists my_course(courseid string comment 课程 id,coursename string comment 课程名称)row format delimited fields terminated bystored as textfile;导入数据:/root/data/
7、step2_flies/load data local inpath 1 /root/data/step2_filesZ, into table my_course; 一-査询选修了 3门以上的课程的学生姓名。select ,from(select id, count (courseid) coursenumfrom my_score group by id) t, my_stu stuwhere =3 and 二;end第3关:课程选修人数禁止修改drop database if exists mydb cascade;禁止修改begin 创建mydb数据库create database i
8、f not exists mydb;一-使用mydb数据库use mydb;创建表my_stucreate table if not exists my_stu( id string comment 学生 id, name string comment 学生姓洛,sex string comment 性别,age string comment 年龄,col string comment 所选的系)row format delimited fields terminated by ,stored as textfile;导入数据:/root/data/step2_files/load data
9、local inpath J/root/data/step2_filesZ, into table my_stu; 创建表my_scorecreate table if not exists my_score(id string comment 学生 id,courseid string comment 课程 id,score string comment 成绩)row format delimited fields terminated bystored as textfile;导入数据:/root/data/step2_flies/load data local inpath /root/
10、data/step2_files/ into table my_score; 创建表 my_course create table if not exists my_course(courseid string comment 课程 id, coursename string comment 课程轲称)row format delimited fields terminated bystored as textfile;导入数据:/root/data/step2_flies/load data local inpath 1 /root/data/step2_filesZ, into table
11、 my_course; 一-査询每个课程有多少人选修。select ,count(*) from( select name, coursenamefrom(select name, courseidfrom my_score score, my_stu stu where = tl, my_course course where 二 t2group by ; 第4关:shujuku课程的平均成绩禁止修改drop database if exists mydb cascade;禁止修改begin 创建mydb数据库create database if not exists mydb;一-使用my
12、db数据库use mydb;创建表my_stucreate table if not exists my_stu( id string comment 学生 id,, name string comment 学生姓洛, sex string comment 性别, age string comment 年龄, col string comment 所选的系)row formatdelimited fields terminated by , stored as textfile;导入数据:/root/data/step2_files/load data local inpath J/root/
13、data/step2_filesZ, into table 创建表my_scorecreate table if not exists my_score(id string comment 学生 id,,courseid string comment 课程 id,score string comment 成绩) row format delimited fields terminated by ,stored as textfile;导入数据:/root/data/step2_files/load data local inpath /root/data/step2_files/ into table 创建表 my_coursecreate table if not exists my_course(courseid string comment 课程 id, coursename string comment 课程名称)row format delimited fields terminated bystored as textfile;导入数据:/root/data/step2_files/load data local inpath J/root/data/step2_fi
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 安全心理学培训课件下载
- 天津小学二年级数学试卷单选题100道及答案
- 四川省成都市成华区某校2023-2024学年高三上学期期中物理题 无答案
- 安全如厕的重要性
- 安全培训课件-百度网盘
- 江帆中国航天课件
- 行政管理经济法考试前瞻试题及答案
- 外科刀具使用安全执业医师考试试题及答案
- 极致视觉营销课件宝典
- 汉子介绍课件
- 大学物理课件57波尔共振实验
- 秦汉时期的服装
- 麦凯66表格(完全版)
- 少女乙女的恋爱革命全中文攻略
- 竣工资料移交清单
- 酒店水单模板
- 作文-曼娜回忆录全文小说
- 昌江金达天然浓缩乳胶厂项目环境影响报告简本
- 中学生交通安全教育公开课一等奖市赛课获奖课件
- 多关节等速训练与测试系统产品技术要求广州一康医疗设备
- 青海美术馆公开招聘工作人员(临聘)6人模拟备考预测(共1000题含答案解析)综合模拟试卷
评论
0/150
提交评论