数据库考前复习题
1. Make a list of security concerns for a bank. For each item on your list, state whether this
concern relates to physical security, human security, operating system security, or database security.
2. Let the following relation schemas be given
R =(A,B,C)
S =(D,E,F)
Let relations r(R)and s(S) be given. Give an expression in SQL that is equivalent
to each of the following queries.
a. ΠA(r)
b. σB=17 (r)
c. r × s
d. ΠA,F (σC=D(r × s))
2. What are ?ve main functions of a database administrator?
4. Consider the following information about a university database:
Professors have an SSN, a name, an age, a rank, and a research specialty.
Projects have a project number, a sponsor name (e.g., NSF), a starting date, an ending date, and a budget.
Graduate students have an SSN, a name, an age, and a degree program (e.g., M.S. or Ph.D.). Each project is managed by one professor (known as the project’s principal investigator).
Each project is worked on by one or more professors (known as the project’s co-investigators). Professors can manage and/or work on multiple projects.
Each project is worked on by one or more graduate students (known as the project’s research assistants).
When graduate students work on a project, a professor must supervise their work on the project. Graduate students can work on multiple projects, in which case they will have a (potentially di?erent) supervisor for each one.
Departments have a department number, a department name, and a main o?ce.
Departments have a professor (known as the chairman) who runs the department.
Professors work in one or more departments, and for each department that they work in, a time percentage is associated with their job.
Graduate students have one major department in which they are working on their degree.
Each graduate student has another, more senior graduate student (known as a student advisor) who advises him or her on what courses to take.
Design and draw an ER diagram that captures the information about the university.
Use only the basic ER model here; that is, entities, relationships, and attributes. Be sure to indicate any key and participation constraints.
5. Consider the university database from Exercise 6 and the ER diagram you designed. Write SQL statements to create the corresponding relations and capture as many of the constraints as possible. If you cannot capture some constraints, explain why.
6. Consider the following relations:
Student(snum: integer, sname: string, major: string, level: string, age: integer)
Class(name: string, meets at: string, room: string, ?d: integer)
Enrolled(snum: integer, cname: string)
Faculty(?d: integer, fname: string, deptid: integer)
The meaning of these relations is straightforward; for example, Enrolled has one record per student-class pair such that the student is enrolled in the class.
Write the following queries in SQL. No duplicates should be printed in any of the answers.
1. Find the names of all Juniors (level = JR) who are enrolled in a class taught by I. Teach.
2. Find the age of the oldest student who is either a History major or enrolled in a course taught by I. Teach.
3. Find the names of all classes that either meet in room R128 or have ?ve or more students enrolled.
4. Find the names of all students who are enrolled in two classes that meet at the same time.
1.What are the responsibilities of a DBA?
Answer :The DBA is responsible for:
Designing the logical and physical schemas, as well as widely-used portions of the external schema.
Security and authorization.
Data availability and recovery from failures.
Database tuning: The DBA is responsible for evolving the database, in particular the conceptual and physical schemas, to ensure adequate performance as user requirements change.
2.List four signi?cant differences between a ?le-processing system and a DBMS.
Answer: Some main differences between a database management system and
a ?le-processing system are:
? Both systems contain a collection of data and a set of programs which access that data. A database management system coordinates both the physical and the logical access to the data, whereas a ?le-processing system coordinates only the physical access.
? A database management system reduces the amount of data duplication by
ensuring that a physical piece of data is available to all programs authorized
to have access to it, whereas data written by one program in a ?le-processing
system may not be readable by another program.
? A database management system is designed to allow ?exible access to data
(i.e., queries), whereas a ?le-processing system is designed to allow predetermined access to data (i.e., compiled programs).
? A database management system is designed to coordinate multiple users
accessing the same data at the same time. A ?le-processing systemis usually
designed to allow one or more programs to access different data ?les at
the same time. In a ?le-processing system, a ?le can be accessed by two
programs concurrently only if both programs have read-only access to the
?le.
3. What is logical data independence and why is it important?
Answer: Logical data independence means that users are shielded from changes in the logical structure of the data, i.e., changes in the choice of relations to be stored.
For example, if a relation Students(sid, sname, gpa) is replaced by Studentnames(sid,sname) and Studentgpas(sid, gpa) for some reason, application programs that operate on the Students relation can be shielded from this change by de?ning a view Stu-dents(sid, sname, gpa) (as the natural join of Studentnames and Studentgpas). Thus, application programs that refer to Students need not be changed when the relation Students is replaced by the other two relations. The only change is that instead of storing Students tuples, these tuples are computed as needed by using the view de?nition; this is transparent to the application program.
4.What is a transaction?
Answer:. A transaction is any one execution of a user program in a DBMS. This is the basic unit of change in a DBMS.
5.
内容需要下载文档才能查看
6 The statements to create tables corresponding to entity sets Customer,
Group, and Artist are straightforward and omitted. The other required tables can be created as follows:
(1). CREATE TABLE Classify ( title CHAR(20),
name CHAR(20),
PRIMARY KEY (title, name),
FOREIGN KEY (title) REFERENCES Artwork Paints,
FOREIGN KEY (name) REFERENCES Group )
(2). CREATE TABLE Like Group (name CHAR(20),
cust name CHAR(20),
PRIMARY KEY (name, cust name),
FOREIGN KEY (name) REFERENCES Group,
FOREIGN KEY (cust name) REFERENCES Customer)
(3). CREATE TABLE Like Artist (name CHAR(20),
cust name CHAR(20),
PRIMARY KEY (name, cust name),
FOREIGN KEY (name) REFERENCES Artist,
FOREIGN KEY (cust name) REFERENCES Customer)
(4). CREATE TABLE Artwork Paints ( title CHAR(20),
artist name CHAR(20),
type CHAR(20),
price INTEGER,
year INTEGER,
PRIMARY KEY (title),
FOREIGN KEY (artist name)
References Artist)
7
(1). SELECT E.ename, E.age
FROM Emp E, Works W1, Works W2, Dept D1, Dept D2
WHERE E.eid = W1.eid AND W1.did = D1.did AND D1.dname = ‘Hardware’ and
E.eid = W2.eid AND W2.did = D2.did AND D2.dname = ‘Software
(2). SELECT W.did, COUNT (W.eid)
FROM Works W
GROUP BY W.did
HAVING 2000 < ( SELECT SUM (W1.pct time)
FROM Works W1
WHERE W1.did = W.did )
(3). SELECT E.ename
FROM Emp E
WHERE E.salary > ALL (SELECT D.budget
FROM Dept D, Works W
WHERE E.eid = W.eid AND D.did = W.did)
(4). SELECT DISTINCT D.managerid
FROM Dept D
WHERE 1000000 < ALL (SELECT D2.budget
FROM Dept D2
WHERE D2.managerid = D.managerid )
(5). SELECT E.ename
FROM Emp E
WHERE E.eid IN (SELECT D.managerid
FROM Dept D
WHERE D.budget = (SELECT MAX (D2.budget)
FROM Dept D2))
(6). SELECT D.managerid
FROM Dept D
WHERE 5000000 < (SELECT SUM (D2.budget)
FROM Dept D2
WHERE D2.managerid = D.managerid )
1. 1. Explain the following terms brie?y: attribute, domain, entity, relationship, one-to-many relationship, many-to-many relationship.
Answer 2.1 Term explanations:
Attribute - a property or description of an entity. A toy department employee entity could have attributes describing the employee’s name, salary, and years of service.
Domain - a set of possible values for an attribute.
Entity - an object in the real world that is distinguishable from other objects such as the green dragon toy.
Relationship - an association among two or more entities.
Entity set - a collection of similar entities such as all of the toys in the toy depart- ment.
Relationship set - a collection of similar relationships
One-to-many relationship - a key constraint that indicates that one entity can be associated with many of another entity. An example of a one-to-many relationship is when an employee can work for only one department, and a department can have many employees.
Many-to-many relationship - a key constraint that indicates that many of one entity can be associated with many of another entity. An example of a many- to-many relationship is employees and their hobbies: a person can have many di?erent hobbies, and many people can have the same hobby.
2. Exercise 4.2 Given two relations R1and R2, where R1 contains N1 tuples, R2con- tains N2 tuples, and N2 > N1 > 0, give the minimum and maximum possible sizes (in tuples) for the resulting relation produced by each of the following relational algebra expressions. In each case, state any assumptions about the schemas for R1and R2 needed to make the expression meaningful:
(1) R1∪R2, (2) R1∩R2, (3) R1?R2, (4) R1×R2, (5) σa=5(R1), (6) πa(R1), and (7) R1/R2
Aanswer:
内容需要下载文档才能查看
下载文档
热门试卷
- 2016年四川省内江市中考化学试卷
- 广西钦州市高新区2017届高三11月月考政治试卷
- 浙江省湖州市2016-2017学年高一上学期期中考试政治试卷
- 浙江省湖州市2016-2017学年高二上学期期中考试政治试卷
- 辽宁省铁岭市协作体2017届高三上学期第三次联考政治试卷
- 广西钦州市钦州港区2016-2017学年高二11月月考政治试卷
- 广西钦州市钦州港区2017届高三11月月考政治试卷
- 广西钦州市钦州港区2016-2017学年高一11月月考政治试卷
- 广西钦州市高新区2016-2017学年高二11月月考政治试卷
- 广西钦州市高新区2016-2017学年高一11月月考政治试卷
- 山东省滨州市三校2017届第一学期阶段测试初三英语试题
- 四川省成都七中2017届高三一诊模拟考试文科综合试卷
- 2017届普通高等学校招生全国统一考试模拟试题(附答案)
- 重庆市永川中学高2017级上期12月月考语文试题
- 江西宜春三中2017届高三第一学期第二次月考文科综合试题
- 内蒙古赤峰二中2017届高三上学期第三次月考英语试题
- 2017年六年级(上)数学期末考试卷
- 2017人教版小学英语三年级上期末笔试题
- 江苏省常州西藏民族中学2016-2017学年九年级思想品德第一学期第二次阶段测试试卷
- 重庆市九龙坡区七校2016-2017学年上期八年级素质测查(二)语文学科试题卷
- 江苏省无锡市钱桥中学2016年12月八年级语文阶段性测试卷
- 江苏省无锡市钱桥中学2016-2017学年七年级英语12月阶段检测试卷
- 山东省邹城市第八中学2016-2017学年八年级12月物理第4章试题(无答案)
- 【人教版】河北省2015-2016学年度九年级上期末语文试题卷(附答案)
- 四川省简阳市阳安中学2016年12月高二月考英语试卷
- 四川省成都龙泉中学高三上学期2016年12月月考试题文科综合能力测试
- 安徽省滁州中学2016—2017学年度第一学期12月月考高三英语试卷
- 山东省武城县第二中学2016.12高一年级上学期第二次月考历史试题(必修一第四、五单元)
- 福建省四地六校联考2016-2017学年上学期第三次月考高三化学试卷
- 甘肃省武威第二十三中学2016—2017学年度八年级第一学期12月月考生物试卷
网友关注
- 六年级数学竞赛试题
- 教育集团四年级趣味数学竞赛测试卷
- 数学竞赛班级选拔赛
- 小升初数学试卷E
- 刘霞教学设计
- 2011小升初试卷1
- 品德论文
- 种类繁多的动物教案
- 2010天河省实小升初语文试卷
- 2014重庆实验外国语学校数学测试题答案三(计算题、解方程)
- 2011六年级数学竞赛试卷
- 三年级科普知识竞赛题
- 四年级(1)连军衔 (2015年4月15日)
- 2015人教版六年级上册语文期末测试卷
- 小学四年级下学期奥数测试
- 希望杯近五年决赛真题汇编
- 思想品德教学设计
- 四年级语文知识竞赛抢答题
- 小学科学六年级下册第三单元练习题及答案
- 2015年春三年级数学期中试卷 苏家飞
- 小升初必背——古诗文填空及答案
- 最好的预初暑假班 闸北预初暑假班 吕N老师
- 小升初数学试卷F
- 五年级奥数选拔赛试题2014.3.16
- 班课直线与椭圆相交问题 Microsoft Office Word 文档
- 四月教育培训界大事--师生信横空出世
- 2015上海民办中小学报名流程和政策
- 2014年书人春季班期中复习题(60题)
- 小升初数学试卷C
- 2015.第三周国旗下讲话
网友关注视频
- 冀教版小学数学二年级下册第二周第2课时《我们的测量》宝丰街小学庞志荣
- 六年级英语下册上海牛津版教材讲解 U1单词
- 《空中课堂》二年级下册 数学第一单元第1课时
- 冀教版英语三年级下册第二课
- 第8课 对称剪纸_第一课时(二等奖)(沪书画版二年级上册)_T3784187
- 外研版英语三起5年级下册(14版)Module3 Unit1
- 外研版英语七年级下册module1unit3名词性物主代词讲解
- 【部编】人教版语文七年级下册《过松源晨炊漆公店(其五)》优质课教学视频+PPT课件+教案,辽宁省
- 沪教版牛津小学英语(深圳用) 五年级下册 Unit 10
- 沪教版八年级下册数学练习册21.3(3)分式方程P17
- 北师大版八年级物理下册 第六章 常见的光学仪器(二)探究凸透镜成像的规律
- 外研版英语七年级下册module3 unit2第一课时
- 沪教版牛津小学英语(深圳用) 四年级下册 Unit 7
- 沪教版八年级下册数学练习册21.3(2)分式方程P15
- 【部编】人教版语文七年级下册《泊秦淮》优质课教学视频+PPT课件+教案,广东省
- 苏科版数学 八年级下册 第八章第二节 可能性的大小
- 第五单元 民族艺术的瑰宝_16. 形形色色的民族乐器_第一课时(岭南版六年级上册)_T3751175
- 沪教版牛津小学英语(深圳用) 四年级下册 Unit 12
- 北师大版小学数学四年级下册第15课小数乘小数一
- 青岛版教材五年级下册第四单元(走进军营——方向与位置)用数对确定位置(一等奖)
- 外研版八年级英语下学期 Module3
- 19 爱护鸟类_第一课时(二等奖)(桂美版二年级下册)_T3763925
- 二次函数求实际问题中的最值_第一课时(特等奖)(冀教版九年级下册)_T144339
- 七年级英语下册 上海牛津版 Unit9
- 冀教版小学数学二年级下册第二单元《余数和除数的关系》
- 人教版历史八年级下册第一课《中华人民共和国成立》
- 北师大版数学 四年级下册 第三单元 第二节 小数点搬家
- 8 随形想象_第一课时(二等奖)(沪教版二年级上册)_T3786594
- 沪教版八年级下册数学练习册20.4(2)一次函数的应用2P8
- 【部编】人教版语文七年级下册《泊秦淮》优质课教学视频+PPT课件+教案,天津市
精品推荐
- 2016-2017学年高一语文人教版必修一+模块学业水平检测试题(含答案)
- 广西钦州市高新区2017届高三11月月考政治试卷
- 浙江省湖州市2016-2017学年高一上学期期中考试政治试卷
- 浙江省湖州市2016-2017学年高二上学期期中考试政治试卷
- 辽宁省铁岭市协作体2017届高三上学期第三次联考政治试卷
- 广西钦州市钦州港区2016-2017学年高二11月月考政治试卷
- 广西钦州市钦州港区2017届高三11月月考政治试卷
- 广西钦州市钦州港区2016-2017学年高一11月月考政治试卷
- 广西钦州市高新区2016-2017学年高二11月月考政治试卷
- 广西钦州市高新区2016-2017学年高一11月月考政治试卷
分类导航
- 互联网
- 电脑基础知识
- 计算机软件及应用
- 计算机硬件及网络
- 计算机应用/办公自动化
- .NET
- 数据结构与算法
- Java
- SEO
- C/C++资料
- linux/Unix相关
- 手机开发
- UML理论/建模
- 并行计算/云计算
- 嵌入式开发
- windows相关
- 软件工程
- 管理信息系统
- 开发文档
- 图形图像
- 网络与通信
- 网络信息安全
- 电子支付
- Labview
- matlab
- 网络资源
- Python
- Delphi/Perl
- 评测
- Flash/Flex
- CSS/Script
- 计算机原理
- PHP资料
- 数据挖掘与模式识别
- Web服务
- 数据库
- Visual Basic
- 电子商务
- 服务器
- 搜索引擎优化
- 存储
- 架构
- 行业软件
- 人工智能
- 计算机辅助设计
- 多媒体
- 软件测试
- 计算机硬件与维护
- 网站策划/UE
- 网页设计/UI
- 网吧管理