数据库考前复习题
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月月考生物试卷
网友关注
- 仓库库存量管理制度
- 2012年河北展会信息汇总
- 南京某物流中心项目建议书(可编辑)
- 邮政电子信函业务大有可为
- 物流管理实验指导书201211-交通系
- 粮食物流基地区间支路及其配套管网工程施工组织设计(可编辑)
- 物流专业英语词汇
- 现代物流园区规划与运行模式研究
- 2014_2015国外金属行业展会项目
- 供应链物流监控智能决策支持系统研究
- 由7—11看日本物流行业发展
- [宝典]第八章 展会干事与现场治理计划
- 物资盘点管理手册
- 第三方物流参考资料
- 行业分析模板(DOC 24页)
- 第六章 电子商务物流2006.9.22
- 仓库库存控制管理手册
- 仓库出库管理手册
- 国际物流有限公司冷链物流项目立项申请报告(可编辑)
- 基于可持续发展的资源型城市物流规划研究
- 2014年3月18农业部展会工作管理办法
- 菏泽农业港农副产品物流交易加工中心项目可研投资报告
- 农业部展会工作管理办法
- 物流管理专业前景
- 贵州省中小煤矿物流现状及发展
- 《展会立项策划书》
- 展会需转型 广州家具展迎最后一届秋季展
- 企业物流成本计算研究
- 大年夜富豪购物广场整合营销履行计谋
- 补充 物流与物流管理概述
网友关注视频
- 沪教版牛津小学英语(深圳用) 四年级下册 Unit 4
- 【部编】人教版语文七年级下册《老山界》优质课教学视频+PPT课件+教案,安徽省
- 飞翔英语—冀教版(三起)英语三年级下册Lesson 2 Cats and Dogs
- 河南省名校课堂七年级下册英语第一课(2020年2月10日)
- 沪教版牛津小学英语(深圳用) 四年级下册 Unit 12
- 8.对剪花样_第一课时(二等奖)(冀美版二年级上册)_T515402
- 《空中课堂》二年级下册 数学第一单元第1课时
- 冀教版小学数学二年级下册第二单元《租船问题》
- 【获奖】科粤版初三九年级化学下册第七章7.3浓稀的表示
- 《小学数学二年级下册》第二单元测试题讲解
- 外研版八年级英语下学期 Module3
- 3月2日小学二年级数学下册(数一数)
- 苏科版数学八年级下册9.2《中心对称和中心对称图形》
- 外研版英语三起5年级下册(14版)Module3 Unit1
- 冀教版小学数学二年级下册第二单元《有余数除法的整理与复习》
- 沪教版牛津小学英语(深圳用) 四年级下册 Unit 3
- 二次函数求实际问题中的最值_第一课时(特等奖)(冀教版九年级下册)_T144339
- 外研版英语三起6年级下册(14版)Module3 Unit1
- 北师大版数学四年级下册第三单元第四节街心广场
- 二年级下册数学第三课 搭一搭⚖⚖
- 外研版英语七年级下册module3 unit1第二课时
- 8.练习八_第一课时(特等奖)(苏教版三年级上册)_T142692
- 外研版英语七年级下册module3 unit2第二课时
- 北师大版八年级物理下册 第六章 常见的光学仪器(二)探究凸透镜成像的规律
- 青岛版教材五年级下册第四单元(走进军营——方向与位置)用数对确定位置(一等奖)
- 七年级英语下册 上海牛津版 Unit5
- 冀教版英语三年级下册第二课
- 3.2 数学二年级下册第二单元 表内除法(一)整理和复习 李菲菲
- 19 爱护鸟类_第一课时(二等奖)(桂美版二年级下册)_T502436
- 沪教版牛津小学英语(深圳用) 四年级下册 Unit 7
精品推荐
- 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
- 网吧管理