create database xscj;
use xscj;
CREATE TABLE student
(
s_no bigint(11) UNSIGNED NOT NULL AUTO_INCREMENT unique key comment'学生学号',
s_name VARCHAR(50)NOT NULL comment'学生姓名',
s_sex VARCHAR(2) comment'性别',
s_bir date comment'出生日期',
phone VARCHAR(13) unique key comment'电话',
email VARCHAR(50) unique key comment'电子邮箱',
PRIMARY KEY(s_no)
);
CREATE TABLE score
(
s_no bigint(11) UNSIGNED NOT NULL comment'学生学号' ,
c_no VARCHAR(13) NOT NULL DEFAULT ' ' comment'课程编号',
daily float comment'平时成绩',
final float comment'结业成绩',
primary key(s_no,c_no)
);
CREATE TABLE course
(
c_no CHAR(13) NOT NULL DEFAULT ' ' comment'课程编号',
c_name VARCHAR(50) NULL comment'课程名称',
t_no CHAR(10) NOT NULL DEFAULT ' ' comment'教师编号',
hour float null comment'学分' ,
week int(2) null comment'教学周',
semeste int(1) null comment'开课学期',
PRIMARY KEY(t_no,c_no)
);
CREATE TABLE teacher
(
t_no char(30)NOT NULL COMMENT '教师号',
t_name varchar(30)NOT NULL COMMENT '教师姓名',
major char(30) NULL COMMENT '专业',
prof char(30) NULL COMMENT '职称',
department char(30) COMMENT'院系部门',
PRIMARY KEY(t_no)
);
INSERT
INTO `student`
VALUES
('18122221320', '张凯', '男', '2001/5/6', '13245678547', '36451@qq.com'),
('18122221321', '赵峰', '男', '1999/5/4', '13945678548', 'ABTHE@SOHU.COM'),
('18122221322', '王伟', '男', '2003/8/9', '13245678549', '45SSEEE@163.COM'),
('18122221323', '李成', '男', '2001/9/12', '13245678550', '78962@qq.com'),
('18122221324', '赵晓月', '女', '2002/12/4', '13545678551', '3232459@qq.com'),
('18122221325', '王俊鑫', '男', '2003/4/7', '13845678552', '8989456@qq.com'),
('18137221506', '王枫', '男', '2001/10/5', '13645678553', 'WSWS4875@SOHU.COM'),
('18137221507', '李浩', '男', '2000/11/23', '13888128558', '46SSEEE@163.COM'),
('18137221508', '孙琳', '女', '2002/5/1', '13522078555', '124578@qq.com'),
('19112100070', '陈晨', '男', '2003/4/8', '13243271256', '457822SW@SOHU.COM'),
('19112100071', '吴司', '男', '1999/12/4', '13244673357', 'JEUD@163.COM'),
('19112100072', '李珊', '女', '1998/12/25', '13955089958', '78451@qq.com'),
('19112100073', '钱峰', '男', '2000/4/1', '13945322359', 'BBBTIH@SOHU.COM'),
('19112100074', '张雯', '女', '2000/12/3', '13545612360', 'SSSMOU@163.COM');
INSERT
INTO `score`
VALUES
('18122221320', 'c08123', '85', '95'),
('18122221320', 'a01564', '88', '93'),
('18122221320', 'C06108', '92', '90'),
('18122221321', 'c08123', '85', '94'),
('18122221321', 'C06108', '70', '82'),
('18122221322', 'c08123', '60', '64'),
('18122221322', 'a01327', '53', '50'),
('18122221322', 'a01564', '64', '50'),
('18122221323', 'a01564', '88', '84'),
('18122221323', 'C05103', '85', '86'),
('18122221324', 'c08123', '77', '81'),
('18122221324', 'C05103', '95', '86'),
('18122221325', 'C05103', '88', '92');
INSERT
INTO `course`
VALUES
('c08123', '数据库技术', 't07019', '4', '16', '4'),
('c08123', '数据库技术', 't03117', '4', '16', '4'),
('C06108', '数据结构', 't07019', '4', '16', '3'),
('C06108', '数据结构', 't01247', '4', '16', '3'),
('C05103', '计算机原理', 't01247', '4', '16', '2'),
('C05103', '计算机原理', 't03117', '4', '16', '2'),
('a01327', '高等数学', 't00458', '4', '16', '2'),
('a01327', '高等数学', 't00578', '4', '16', '2'),
('a01564', '马克思原理', 't04410', '2', '12', '1'),
('a01564', '马克思原理', 't04115', '2', '12', '1');
INSERT
INTO `teacher`
VALUES
('t01247', '程瑞', '软件工程', '副教授', '计算机学院'),
('t07019', '刘泽', '软件工程', '讲师', '软件学院'),
('t04213', '汪凌灵', '网络技术', '副教授', '计算机学院'),
('t04115', '刘珊', '哲学', '讲师', '人文学院'),
('t00458', '李泽峰', '数学', '助教', '基础课程学院'),
('t00578', '张伦', '数学', '讲师', '基础课程学院'),
('t02145', '王乐', '英语', '助教', '基础课程学院'),
('t04410', '王伟', '哲学', '副教授', '人文学院'),
('t03117', '孙艳', '软件工程', '讲师', '软件学院');
其中包括创建数据库,建立表格,插入数据
|