CREATE TABLE IF NOT EXISTS 学生表 (
sno CHAR(10) NOT NULL COMMENT '学号',
sn VARCHAR(12) NOT NULL COMMENT '姓名',
sex ENUM('男','女') NOT NULL DEFAULT '男' COMMENT '性别',
dat DATE NOT NULL COMMENT '出生日期',
maj VARCHAR(10) NOT NULL COMMENT '专业',
DEP VARCHAR(10) NOT NULL COMMENT '院系',
pho VARCHAR(11) NOT NULL COMMENT '联系电话',
PRIMARY KEY (sno)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci;
INSERT INTO 学生表 (sno,sn,sex,dat,maj,DEP,pho)
VALUES ('0433','张艳','女','2000-9-13','计算机','信息学院',' '),
('0496','李越','女','2001-1-23','信息','信息学院','1381290xxxx'),
('0529','赵欣','男','2002-2-27','信息','信息学院','1350222xxxx'),
('0531','张志国','女','2002-10-10','自动化','工学院','1331256xxxx'),
('0538','于兰兰','男','2002-2-1','数学','理学院','1331200xxxx'),
('0591','王丽丽','女','2003-3-21','计算机','信息学院','1332080xxxx'),
('0592','王海强','女','2003-9-1','数学','理学院','');
CREATE TABLE IF NOT EXISTS 课程表 (
course_sno CHAR(10) NOT NULL COMMENT '课程号',
cn CHAR(30) NOT NULL COMMENT '课程名',
cnu FLOAT(6) NOT NULL COMMENT '学分数',
cti FLOAT(6) NOT NULL COMMENT '学时数',
tec VARCHAR(12) NOT NULL COMMENT '任课教师',
PRIMARY KEY (course_sno)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci;
INSERT INTO 课程表 (course_sno,cn,cnu,cti,tec)
VALUES ('K001','计算机图形学','2.5','40','胡晶晶'),
('K002','计算机应用基础','3','48','任泉'),
('K006','数据结构','4','64','马跃先'),
('M001','政治经济学','4','64','孔繁新'),
('S001','高等数学','3','48','赵晓尘');
CREATE TABLE IF NOT EXISTS 学生成绩表 (
course_sno CHAR(10) NOT NULL COMMENT '课程号',
sno CHAR(10) NOT NULL COMMENT '学号',
tim TIMESTAMP NOT NULL COMMENT '选课时间',
nor INT NOT NULL COMMENT '平时成绩',
pro FLOAT NOT NULL COMMENT '平时成绩比重',
tex INT NOT NULL COMMENT '考试成绩',
PRIMARY KEY (course_sno, sno)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci;
INSERT INTO 学生成绩表(course_sno, sno, tim, nor, pro, tex)
VALUES ('K001','0433','2017-8-23 16:14:11',90.5,0.4,93.5),
('K001','0529','2017-8-24 8:15:11',85,0.3,90),
('K001','0531','2017-8-25 10:18:34',57,0.4,75),
('K001','0591','2017-8-24 15:20:24',81.5,0.4,71.5),
('K002','0496','2018-2-25 15:20:24',NULL,0.3,NULL),
('K002','0529','2018-2-24 10:15:21',70,0.4,83),
('K002','0531','2018-2-25 13:20:19',75,0.2,81.5),
('K002','0538','2018-2-24 14:20:24',70.5,0.4,73),
('K002','0592','2018-2-15 9:18:12',85,0.4,NULL),
('K006','0531','2018-8-25 19:17:25',93,0.3,86),
('K006','0591','2018-8-24 13:19:45',85,0.4,82),
('M001','0496','2019-2-23 10:8:11',83,0.3,91),
('M001','0591','2019-2-25 12:14:12',92.5,0.4,89),
('S001','0531','2019-8-26 13:15:12',82.5,0.4,77),
('S001','0538','2019-8-27 15:10:12',75.2,0.3,NULL);