create database if not exists school2 default charset=utf8;
use school2;
create table Student(
Sno varchar(20)not null,
Sname varchar(20)not null,
Ssex varchar(20)not null,
Sbirthday datetime null,
Class varchar(20) null
);
insert into Student (Sno ,Sname, Ssex,Class) values('108','曾华','男','95033');
insert into Student (Sno ,Sname, Ssex,Class) values('105',"匡明",'男',',95031');
insert into Student (Sno ,Sname, Ssex,Class) values('107',"王丽",'女','95033');
insert into Student (Sno ,Sname, Ssex,Class) values('101',"李军",'男','95033');
insert into Student (Sno ,Sname, Ssex,Class) values('109',"王芳",'女','95031');
insert into Student (Sno ,Sname, Ssex,Class) values('103',"陆军",'男','95031');
select* from student;
CREATE TABLE teacher
(
Tno
varchar(20) NOT NULL COMMENT '教工编号',
Tname
varchar(20) NOT NULL COMMENT '教工姓名',
Tsex
varchar(20) NOT NULL COMMENT '教工性别',
Tbirthday
varchar(0) DEFAULT NULL COMMENT '教工出生年月',
Prof
varchar(20) DEFAULT NULL COMMENT '职称',
Depart
varchar(20) NOT NULL COMMENT '教工所在部门'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
create table Course(
Cno varchar(20)not null,
Cname varchar(20)not null,
Tno varchar(20) not null
);
insert into Course values('3-125','计算机导论','825');
insert into Course values('3-245','操作系统','804');
insert into Course values('6-166','数字电路','856');
insert into Course values('9-888','高等数学','831');
select* from Course;
create table Score(
Sno varchar(20)not null,
Cno varchar(20) not null ,
Degree Decimal(4,1) null
);
insert into Score values('103','3-245','86');
insert into Score values('105','3-245','75');
insert into Score values('109','3-245','68');
insert into Score values('103','3-105','75');
insert into Score values('105','3-105','92');
insert into Score values('109','3-105','88');
insert into Score values('101','3-105','76');
insert into Score values('107','3-105','64');
insert into Score values('108','3-105','91');
insert into Score values('101','6-166','78');
insert into Score values('107','6-166','85');
insert into Score values('108','6-166','81');
select* from Score;