数据库考前复习题
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月月考生物试卷
网友关注
- 钢球硬度与磨矿机衬板硬度的匹配关系
- 重资引进国际先进生产线 国昌天宇蓄谋技术转型
- 通技6班 王伟强
- Whiter
- 武汉厨房装修设计指南
- 409L的加工性能
- 水果盒2
- 农业机器人视觉导航的预测跟踪控制方法研究_周俊
- 谈跟踪审计中的变更控制
- 传统实木门业产能过剩 行业发展受阻
- 中美抗震规范地震作用计算方法对比分析
- 钢丝绳
- 基于平行直线的摄像机标定方法_马长正
- 文献综述-吴松霖
- 火铺矿设备管理制度
- 多绳摩擦式提升机系统
- 富兰德润滑脂蒸发度测定仪
- 阻燃服的相关知识
- 工业齿轮油规格
- 槽钢这是每米重量
- 船价估算
- 低压流体输送用焊接钢管和镀锌焊接钢管的尺寸规格
- 基于两灭点法的摄像机标定方法研究_胡桂廷
- 光收发器光网络发展现状及前景
- 高级制表业最传统 三款传统顶级男表5.5
- 沁水盆地煤层气地质条件评价
- 瓷砖价格表
- 基于有理函数式镜头畸变模型的摄像机标定_黄军辉
- 高端家居卖场下沉 陷入尴尬境地
- 沁水盆地煤层气资源量评价与勘探预测
网友关注视频
- 冀教版小学数学二年级下册第二单元《租船问题》
- 苏教版二年级下册数学《认识东、南、西、北》
- 精品·同步课程 历史 八年级 上册 第15集 近代科学技术与思想文化
- 【获奖】科粤版初三九年级化学下册第七章7.3浓稀的表示
- 【部编】人教版语文七年级下册《泊秦淮》优质课教学视频+PPT课件+教案,湖北省
- 第五单元 民族艺术的瑰宝_15. 多姿多彩的民族服饰_第二课时(市一等奖)(岭南版六年级上册)_T129830
- 人教版二年级下册数学
- 第五单元 民族艺术的瑰宝_16. 形形色色的民族乐器_第一课时(岭南版六年级上册)_T1406126
- 外研版英语三起6年级下册(14版)Module3 Unit1
- 二年级下册数学第一课
- 【部编】人教版语文七年级下册《老山界》优质课教学视频+PPT课件+教案,安徽省
- 第五单元 民族艺术的瑰宝_16. 形形色色的民族乐器_第一课时(岭南版六年级上册)_T3751175
- 3月2日小学二年级数学下册(数一数)
- 外研版英语三起5年级下册(14版)Module3 Unit1
- 沪教版牛津小学英语(深圳用) 四年级下册 Unit 12
- 河南省名校课堂七年级下册英语第一课(2020年2月10日)
- 苏科版数学 八年级下册 第八章第二节 可能性的大小
- 沪教版牛津小学英语(深圳用)五年级下册 Unit 1
- 冀教版小学数学二年级下册第二周第2课时《我们的测量》宝丰街小学庞志荣
- 【部编】人教版语文七年级下册《逢入京使》优质课教学视频+PPT课件+教案,安徽省
- 沪教版八年级下册数学练习册21.3(2)分式方程P15
- 七年级英语下册 上海牛津版 Unit3
- 化学九年级下册全册同步 人教版 第22集 酸和碱的中和反应(一)
- 苏科版数学七年级下册7.2《探索平行线的性质》
- 外研版英语七年级下册module3 unit1第二课时
- 沪教版八年级下册数学练习册20.4(2)一次函数的应用2P8
- 冀教版小学数学二年级下册第二单元《有余数除法的简单应用》
- 8.练习八_第一课时(特等奖)(苏教版三年级上册)_T142692
- 苏科版数学八年级下册9.2《中心对称和中心对称图形》
- 沪教版八年级下次数学练习册21.4(2)无理方程P19
精品推荐
- 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
- 网吧管理