《练习2_习题_结果.doc》由会员分享,可在线阅读,更多相关《练习2_习题_结果.doc(21页珍藏版)》请在金锄头文库上搜索。
1、现在有一教学管理系统,具体的关系模式如下:Student (no, name, sex, birthday, class)Teacher (no, name, sex, birthday, prof, depart)Course (cno, cname, tno)Score (no, cno, degree)其中表中包含如下数据:Course表:Score表:Student表:Teacher表:根据上面描述完成下面问题:(注意:注意保存脚本,尤其是DDL和DML,以便进行数据还原)DDL1. 写出上述表的建表语句。命令:USE 教学库CREATE TABLE Student(no char(1
2、0) NOT NULL,name char(10) NOT NULL,sex char(5) NOT NULL,birthday smalldatetime NOT NULL,class char(10) NOT NULL)USE 教学库CREATE TABLE Teacher(no char(4) NOT NULL,name char(8) NOT NULL,sex char(2) NOT NULL,birthday smalldatetime NOT NULL,pro char(6) NOT NULL,depart char(10) NOT NULL)USE 教学库CREATE TABLE
3、 Course(cno char(6) NOT NULL,cname char(10) NOT NULL,tno tinyint NOT NULL)USE 教学库CREATE TABLE Score(no char(10) NOT NULL,cno char(6) NOT NULL,degree tinyint NOT NULL)DML2. 给出相应的INSERT语句来完成题中给出数据的插入。命令:USE 教学库INSERT into Student(no,name,sex,birthday,class)VALUES(5001,李勇,男,1987-7-22 0:00:00,95001)INSE
4、RT into Student(no,name,sex,birthday,class)VALUES(5002,刘晨,女,1987-11-15 0:00:00,95002)INSERT into Student(no,name,sex,birthday,class)VALUES(5003,王敏,女,1987-10-5 0:00:00,95001)INSERT into Student(no,name,sex,birthday,class)VALUES(5004,李好尚,男,1987-9-25 0:00:00,95003)INSERT into Student(no,name,sex,birthd
5、ay,class)VALUES(5005,李军,男,1987-7-17 0:00:00,95004)INSERT into Student(no,name,sex,birthday,class)VALUES(5006,范新位,女,1987-6-18 0:00:00,95005)INSERT into Student(no,name,sex,birthday,class)VALUES(5007,张霞东,女,1987-8-29 0:00:00,95006)INSERT into Student(no,name,sex,birthday,class)VALUES(5008,赵薇,男,1987-6-1
6、5 0:00:00,95007)INSERT into Student(no,name,sex,birthday,class)VALUES(5009,钱明将,女,1987-6-23 0:00:00,95008)INSERT into Student(no,name,sex,birthday,class)VALUES(5010,孙俪,女,1987-9-24 0:00:00,95002)INSERT into Student(no,name,sex,birthday,class)VALUES(108,赵里,男,1987-6-15 0:00:00,95007)INSERT into Student(
7、no,name,sex,birthday,class)VALUES(109,丘处机,男,1987-6-23 0:00:00,95008)INSERT into Student(no,name,sex,birthday,class)VALUES(107,杨康,男,1987-9-24 0:00:00,95001)USE 教学库INSERT into Teacher(no,name,sex,birthday,pro,depart)VALUES(1,李卫,男,1957-11-5 0:00:00,教授,电子工程系)INSERT into Teacher(no,name,sex,birthday,pro,
8、depart)VALUES(2,刘备,男,1967-10-9 0:00:00,副教授,math)INSERT into Teacher(no,name,sex,birthday,pro,depart)VALUES(3,关羽,男,1977-9-20 0:00:00,讲师,sc)INSERT into Teacher(no,name,sex,birthday,pro,depart)VALUES(4,李修,男,1957-6-25 0:00:00,教授,elec)INSERT into Teacher(no,name,sex,birthday,pro,depart)VALUES(5,诸葛亮,男,197
9、7-6-15 0:00:00,教授,计算机系)INSERT into Teacher(no,name,sex,birthday,pro,depart)VALUES(6,殷素素,女,1967-1-5 0:00:00,副教授,sc)INSERT into Teacher(no,name,sex,birthday,pro,depart)VALUES(7,周芷若,女,1947-2-23 0:00:00,教授,sc)INSERT into Teacher(no,name,sex,birthday,pro,depart)VALUES(8,赵云,男,1980-6-13 0:00:00,副教授,计算机系)IN
10、SERT into Teacher(no,name,sex,birthday,pro,depart)VALUES(9,张敏,女,1985-5-5 0:00:00,助教,sc)INSERT into Teacher(no,name,sex,birthday,pro,depart)VALUES(10,黄蓉,女,1967-3-22 0:00:00,副教授,sc)INSERT into Teacher(no,name,sex,birthday,pro,depart)VALUES(11,张三,男,1967-3-22 0:00:00,副教授,sc)USE 教学库INSERT into Course(cno
11、,cname,tno)VALUES(3-101,数据库,1)INSERT into Course(cno,cname,tno)VALUES(5-102,数学,3)INSERT into Course(cno,cname,tno)VALUES(3-103,信息系统,4)INSERT into Course(cno,cname,tno)VALUES(3-104,操作系统,6)INSERT into Course(cno,cname,tno)VALUES(3-105,数据结构,4)INSERT into Course(cno,cname,tno)VALUES(3-106,数据处理,5)INSERT
12、into Course(cno,cname,tno)VALUES(4-107,pascal语言,5)INSERT into Course(cno,cname,tno)VALUES(4-108,c+,7)INSERT into Course(cno,cname,tno)VALUES(4-109,java,8)INSERT into Course(cno,cname,tno)VALUES(3-245,数据挖掘,10)INSERT into Course(cno,cname,tno)VALUES(3-111,软件工程,11)USE 教学库INSERT into Score(no,cno,degree
13、)VALUES(5001,3-105,69)INSERT into Score(no,cno,degree)VALUES(5001,5-102,55)INSERT into Score(no,cno,degree)VALUES(5003,4-108,85)INSERT into Score(no,cno,degree)VALUES(5004,3-105,77)INSERT into Score(no,cno,degree)VALUES(5005,3-245,100)INSERT into Score(no,cno,degree)VALUES(5006,3-105,53)INSERT into
14、Score(no,cno,degree)VALUES(5003,4-109,45)INSERT into Score(no,cno,degree)VALUES(5008,3-105,98)INSERT into Score(no,cno,degree)VALUES(5004,4-109,68)INSERT into Score(no,cno,degree)VALUES(5010,3-105,88)INSERT into Score(no,cno,degree)VALUES(5003,3-105,98)INSERT into Score(no,cno,degree)VALUES(5005,4-109,68)INSERT into Score(no,cno,degree)VALUES(5002,3-105,88)INSERT into Score(no,cno,degree)VALUES(107,3-105,98)