- pdf 下载:明码 7281
- 专栏目录首页:【专栏必读】(考研复试)数据库系统概论第五版(王珊)专栏学习笔记目录导航及课后习题答案详解
名词解释
- 视图 :视图是一个虚表,其本质就是一条
SELECT
语句,而查问后果被赋予了一个名字,也即视图名字。或者说视图自身不蕴含任何数据,它只蕴含映射到基表的一个查问语句,当基表数据发生变化时,视图数据也随之变动。其目标就是在于不便,简化数据操作
简答题
【答案】
【答案】
【答案】
根本表是自身独立存在的表,在 sQL 中一个关系就对应一个表。视图是从一个或几个根本表导出的表。视图自身不独立存储在数据库中,是一个虚表。即数据库中只寄存视图的定义而不寄存视图对应的数据,这些数据仍寄存在导出视图的根本表中。视图在概念上与根本表等同,用户能够如同根本表那样应用视图,能够在视图上再定义视图
【答案】
【答案】
根本表的行列子集视图个别是可更新的。若视图的属性来自汇合函数、表达式,则该视图必定是不能够更新的
应用题
【答案】
SELECT * FROM S WHERE A='10';
SELECT A,B FROM S;
SELECT A,B,S.C,S.D,E,F FROM S,T WHERE S.C=T.C AND S.D=T.D;
SELECT * FROM S,T WHERE S.C=T.C;
SELECT * FROM S,T WHERE A<E;
SELECT S.C,S.D,T.* FROM S,T;
- 题目链接:(数据库系统概论 | 王珊)第二章关系数据库:习题
【答案】
SELECT SNO FROM SPJ WHERE JNO='J1';
SELECT SNO FROM SPJ WHERE JNO='J1' AND PNO='P1';
SELECT SPJ.SNO FROM SPJ,P WHERE SPJ.PNO=P.PNO AND JNO='J1' AND COLOR='红';
SELECT JNO FROM SPJ WHERE JNO NOT IN
(SELECT JNO FROM SPJ,S,P WHERE S.CITY='天津' AND COLOR='红' AND SPJ.SNO=S.SNO AND SPJ.PNO=P.PNO)
①:先查问 S1 供给的整机号
SELECT PNO FROM SPJ WHERE SNO='S1',其后果为(P1,P2)②:查问哪一个工程即应用 P1 又应用 P2
SELECT JON FROM SPJ WHERE PNO='P1' AND JNO IN (SELECT JNO FROM SPJ WHERE PNO='P2');
SELECT SNAME,CTIY FROM S;
SELECT PNAME,COLOR,WEIGHT FROM P;
SELECT JNO FROM SPJ WHERE SNO='S1';
SELECT PNAME,QTY FROM P,SPJ WHERE SPJ.PNO=P.PNO AND JNO='J2';
SELECT PNO FROM SPJ,S WHERE SPJ.SNO=S.SNO AND S.CITY='上海';
SELECT JNAME FROM SPJ,S,J WHERE SPJ.SNO=S.SNO AND SPJ.JNO=J.JNO AND S.CITY='上海';
SELECT JNO FROM SPJ WHERE JNO NOT IN(SELECT JNO FROM SPJ,S WHERE SPJ.SNO=S.SNO AND S.CITY='天津');
UPDATE P SET COLOR='蓝' WHERE COLOR='红';
UPDATE SPJ SET SNO='S3' WHERE SNO='S5' AND JNO='J4' AND PNO='P6';
DELETE FROM S WHERE SNO='S2' DELETE FROM SPJ WHERE SNO='S2';
INSERT INTO SPJ VALUES('S2','J6','P4',200);
【答案】
CREATE VIEW VSP AS SELECT SNO,SPJ.PNO,QTY FROM SPJ,J WHERE PPJ.JNO=J.JNO AND J.JNAME='三建'
SELECT PNO,QTY FROM VSP
SELECT * FROM VSP WHERE SNO='S1';