数据库考前复习题
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月月考生物试卷
网友关注
- 如何选择女性墨镜
- 墨尔本大学美术专业
- 论述中国外交布局及对中国特色大国外交的认识
- 张大千山水画赏析
- 论文模板
- 墨尔本大学传媒硕士
- 新型广告媒介
- 换挡顿挫感原因分析
- 应天齐:循序渐进的当代艺术探索
- 你没发现的神奇数字
- 《形态设计》智能产品市场调研
- 我承诺 我奋斗
- 电影单
- 品味不同于奢华
- 长春市轿车市场研究
- 区域整治
- 我的设想
- 情怀辞职
- 2015年1月时事要闻 (每日新闻摘取,有重点)
- 《忆苦思廉》征文(朱晓华)
- 翻译 寻求道德的多结构模型
- ChangeLog
- 中国梦强军梦我的梦
- 现代漆画:当今新兴画种的市场之路
- 录音文稿
- 侧光看纹理,辨别白玉产地
- 詹姆斯库克大学新闻文科专业
- 阳朔
- 微电影、婚礼价格方案
- 新书解读习近平“四个全面”战略布局
网友关注视频
- 沪教版牛津小学英语(深圳用) 六年级下册 Unit 7
- 沪教版牛津小学英语(深圳用) 五年级下册 Unit 10
- 第12章 圆锥曲线_12.7 抛物线的标准方程_第一课时(特等奖)(沪教版高二下册)_T274713
- 人教版二年级下册数学
- 飞翔英语—冀教版(三起)英语三年级下册Lesson 2 Cats and Dogs
- 3月2日小学二年级数学下册(数一数)
- 【部编】人教版语文七年级下册《过松源晨炊漆公店(其五)》优质课教学视频+PPT课件+教案,江苏省
- 三年级英语单词记忆下册(沪教版)第一二单元复习
- 3.2 数学二年级下册第二单元 表内除法(一)整理和复习 李菲菲
- 第五单元 民族艺术的瑰宝_16. 形形色色的民族乐器_第一课时(岭南版六年级上册)_T1406126
- 冀教版小学英语五年级下册lesson2教学视频(2)
- 七年级英语下册 上海牛津版 Unit3
- 冀教版英语四年级下册第二课
- 【部编】人教版语文七年级下册《老山界》优质课教学视频+PPT课件+教案,安徽省
- 外研版英语七年级下册module3 unit2第二课时
- 8.练习八_第一课时(特等奖)(苏教版三年级上册)_T142692
- 小学英语单词
- 外研版英语七年级下册module3 unit2第一课时
- 《小学数学二年级下册》第二单元测试题讲解
- 北师大版数学四年级下册3.4包装
- 19 爱护鸟类_第一课时(二等奖)(桂美版二年级下册)_T3763925
- 人教版历史八年级下册第一课《中华人民共和国成立》
- 沪教版牛津小学英语(深圳用) 四年级下册 Unit 8
- 冀教版小学英语四年级下册Lesson2授课视频
- 【部编】人教版语文七年级下册《逢入京使》优质课教学视频+PPT课件+教案,安徽省
- 每天日常投篮练习第一天森哥打卡上脚 Nike PG 2 如何调整运球跳投手感?
- 冀教版小学数学二年级下册第二单元《有余数除法的简单应用》
- 第五单元 民族艺术的瑰宝_16. 形形色色的民族乐器_第一课时(岭南版六年级上册)_T3751175
- 沪教版八年级下次数学练习册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
- 网吧管理