insert into StudentInfo
values
('181001','程志强','男','1988-08-17','计算机','北京市海淀区'),
('181002','孙红梅','女','1997-11-23','计算机','成都市锦江区'),
('181003','朱丽','女','1998-02-19','计算机','北京市海淀区'),
('184001','王志勇','男','1997-12-05','电子信息工程','null'),
('184002','周潞潞','女','1998-02-24','电子信息工程','上海市浦东区'),
('184004','郑永波','男','1997-09-19','电子信息工程','上海市浦东区');
#查看数据表内容记录
select * from studentinfo;
create table courseinfo
(
courseid varchar(4) not null primary key comment '课程号',
coursename varchar(16) not null comment '课程名',
credit tinyint null comment '学分'
)comment '学生表';
create table scoreinfo
(
studentid varchar(6) not null comment'学号',
courseid varchar(4) not null comment'课程号',
grade tinyint null comment'成绩',
primary key(studentid,courseid)
);
create table teacherinfo
(
teacherid varchar(6) not null primary key comment'教师编号',
teachername varchar(8) not null comment'姓名',
teachersex varchar(2) not null default '男' comment'性别',
teacherbirthday date not null comment'出生日期',
school varchar(12) null comment'学院',
address varchar(20) null comment'地址'
);
insert into courseinfo
values
('1004','数据库系统','4'),
('1025','物联网技术','3'),
('4002','数字电路','3'),
('801','高等数学','4'),
('1201','英语','4');
select * from courseinfo;
insert into scoreinfo
values
('181001','1004','95'),
('181002','1004','85'),
('181003','1004','91'),
('184001','4002','93'),
('184002','4002','76'),
('184004','4002','88'),
('181001','8001','94'),
('181002','8001','89'),
('181003','8001','86'),
('184001','8001','85'),
('184002','8001',null),
('184004','8001','94'),
('181001','1201','92'),
('181002','1201','78'),
('181003','1201','94'),
('184001','1201','85'),
('184002','1201','79'),
('184004','1201','94');
select * from scoreinfo;
insert into teacher
values
('100006','何艺杰','男','1970-06-23','教授','计算机学院'),
('100023','孙浩然','男','1979-04-09','教授','计算机学院'),
('400017','李亚兰','女','1988-11-04','讲师','通信学院'),
('800028','袁万明','男','1978-08-15','副教授','数学学院'),
('120045','刘颖','女','1976-12-15','副教授','外国语学院');
select * from teacher;
create table lecture
(
tno char(6) not null comment'教师编号',
cno char(4) not null comment'课程号',
location char(10) null comment'上课地点',
primary key(tno,cno)
)comment'讲座';
desc lecture;
insert into lecture
values
('100006','1004','2-311'),
('400017','4002','1-106'),
('800028','8001','6-104'),
('120046','1201','6-215');
select*from lecture;