作者:MetaTrade

Hivesql基础查询

6.1 环境准备
本章所有的练习题都将基于同一组数据表,本节需要完成数据准备工作
1. 创建数据表
hive>
-- 创建学生表
DROP TABLE IF EXISTS student_info;
create table if not exists student_info(
stu_id string COMMENT '学生 id',
stu_name string COMMENT '学生姓名',
birthday string COMMENT '出生日期',
sex string COMMENT '性别'
)
row format delimited fields terminated by ','
stored as textfile;
-- 创建课程表
DROP TABLE IF EXISTS course_info;
create table if not exists course_info(
course_id string COMMENT '课程 id',
course_name string COMMENT '课程名',
tea_id string COMMENT '任课老师 id'
)
row format delimited fields terminated by ','
stored as textfile;
-- 创建老师表
DROP TABLE IF EXISTS teacher_info;
create table if not exists teacher_info(
te
lock