Mysql
——————学生表——----
CREATE table student(
student_id varchar(4) ---学生编号
,name varchar(20) ---学生姓名
,birthday varchar(10) ---学生生日
,sex varchar(2) ---学生性别
);
CREATE TABLE `student` (
`student_id` varchar(4) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`name` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`birthday` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`sex` varchar(2) COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
HIVE
——————学生表——————
create table study.student (
student_id string -- 学生编号
,name string -- 学生姓名
,birthday string -- 学生生日
,sex string -- 学生性别
)
stored as parquet
tblproperties("orc.compress"="snappy");
Mysql
——————教师表——----
CREATE table teacher(
teacher_id varchar(4)
,name varchar(20)
);
HIVE
——————教师表——————
create table study.teacher (
teacher_id string -- 教师编号
,name string -- 教师姓名
)
stored as parquet
tblproperties("orc.compress"="snappy");
Mysql
——————课程表——----
CREATE table course(
course_id varchar(4)
,name varchar(20) ,teacher_id varchar(4)
);
HIVE
——————课程表——————
create table study.course (
course_id string -- 课程编号
,name string -- 课程名
,teacher_id string -- 课程对应的教师编号
)
stored as parquet
tblproperties("orc.compress"="snappy");
Mysql
——————成绩表——----
CREATE table score(
student_id varchar(4)
,course_id varchar(4)
,score int
);
Hive
——————成绩表——----
create table study.score (
student_id string -- 学生编号
,course_id string -- 课程编号
,score int -- 对应的成绩
)
stored as parquet
tblproperties("orc.compress"="snappy");
答题时请注意&