数据库系统概念习题课.ppt_第1页
数据库系统概念习题课.ppt_第2页
数据库系统概念习题课.ppt_第3页
数据库系统概念习题课.ppt_第4页
数据库系统概念习题课.ppt_第5页
已阅读5页,还剩15页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、习题,单选题:10分 填空题:10分 简答题:12分 关系代数运算:12分 SQL:30分 E-R图与转换:16分 模式分解:10分,上次考试各题型所占分数:,2,Single Choice,The database system provides an abstract view of the data, this is achieved through several level of abstraction, among these levels, the (_) describes part of the logical structure of the database. Physi

2、cal level Logical level View level Application level,C,3,Single Choice,Witch one of the following is not true for schema normalization? (_) In relational model, any legal relation schema must satisfies 1NF For any relation schema, there is always a lossless-join, dependency preserving decomposition

3、into 3NFs Relations with only 3 attributes are automatically in BCNF If , then is a trivial functional dependency,C,4,Fill In the Following Blanks,Database system provides Data Definition Language(DDL) to specify database schema, and (_DML_) to express database queries and updates. Collection of ope

4、rations that form a single logical unit of work in database system are called (_Transaction_).,5,Answer The Following Questions,Briefly describe the difference between database schema and database instance. Briefly describe the difference between tables and views.,6,Relational Algebra,R4 = A ( R ) (

5、 R S ),7,Compose SQL,Consider the database of a clinic described below (the primary keys are underlined): Patient (PatCode, Name, Age, Sex, Street, City, Occupation) Operation (OperCode, PatCode, DoctCode, OperDate,OperTime, Detail) Doctor (DoctCode, Name, Specialty, Age) Diagnosed_By (PatCode, Doct

6、Code, DiagDate, DiagTime, Prescription),8,Compose SQL,Define the relation schema Operation in SQL (indicates Primary Key and Foreign Key) List all patients diagnosed or operated by doctor “smith” Find all doctors who have diagnosed all patients whos age are below 12.,9,Create Table Operation( OperCo

7、de Char(30), PatCode Char(15), DocCode Char(15), DiagDate Date, DiagTime Time, Detail VarChar(255), Primary Key(OperCode), Foreign Key(PatCode) References Patient, Foreign Key(DocCode) References Doctor),1.,Define the relation schema Operation in SQL,10,2.,Using Union,(Select Patient.Name From Docto

8、r, Operation, Patient Where Doctor.DocCode = Operation.DocCode AND Operation.PatCode=Patient.PatCode AND Doctor.Name=Smith) Union (Select Patient.Name From Doctor, Diagnosed_by, Patient Where Doctor.DocCode = Diagnosed_by.DocCode AND Diagnosed_by.PatCode=Patient.PatCode AND Doctor.Name=Smith),List a

9、ll patients diagnosed or operated by doctor “smith”,11,2.,Using Subquery,Select Patient.Name From Patient Where Exists( Select * From Doctor, Operation Where Doctor.DocCode=Operation.DocCode AND Doctor.Name=Smith AND Operation.PatCode=Patient.PatCode) OR Exists( Select * From Doctor, Diagnosed_by Wh

10、ere Doctor.DocCode=Diagnosed_by.DocCode AND Doctor.Name=Smith AND Diagnosed_by.PatCode=Patient.PatCode),List all patients diagnosed or operated by doctor “smith”,12,3.,Using Subquery,Select Doctor.Name From Doctor D Where Not Exists( Select * From Patient P Where Age 12 AND Not Exists( Select * From

11、 Diagnosed_by Where Diagnosed_by.DocCode=D.DocCode AND Diagnosed_by.PatCode=P.PatCode),Find all doctors who have diagnosed all patients whos age are below 12.,13,3.,Using Set Operations,Select Doctor.Name From Doctor D Where Not Exists( (Select Patient.PatCode From Patient Where Patient.Age 12) EXCE

12、PT (Select Diagnosed_by.PatCode From Diagnosed_by Where Diagnosed_by.DocCode=D.DocCode) ),Find all doctors who have diagnosed all patients whos age are below 12.,14,E-R Model,The Chinese Film Institute collects statistics about movies and moviegoers in china. These statistics is stored in a database

13、. This database has the following entity sets -Movies, with attributes movie_id, movie_name, production_year, country. -Movie Theaters, with attributes theater_id, thearter_name, city. -Screen, with attributes screen_id, screen_name. It is a weak entity set, its identifying entity set is Movie Theat

14、ers, its discriminator is screen_id. (movie theater contains one or more screens, where the movies are shown.),15,E-R Model,In addition there are the following relationship sets: -In, The identifying relationship set between Screen and Movie Theaters. -Shows, The movies are showed on different scree

15、ns, and we need to store data about the movie shows that have occurred: which movie that was shown, on which screen, at what time, and how many visitors there were.,16,E-R Model,Design an Entity-Relationship diagram with the given entity sets and relationship sets. Translate the E-R diagram into rel

16、ation schemas.,Chapter7 Relational Database Design,17,Movie,1.,Show,18,Movie(Movie_id, Movie_name, production_year,country),Theater(theater_id, theater_name, city),Screen(theater_id, screen_id, screen_name),Show(movie_id, theater_id, screen_id, date, visitor_number),2.,19,Schema Normalization,Given

17、is the following set of functional dependencies F for a relation schema R: R=A, B, C, D, E, G F=ED, CB, CEG, BA Attribute set (C, E) is the only candidate key of R. Decide whether relation schema R is in BCNF. If it is not, describe why Decompose relations R, if necessary, into a collection of relations that are in BCNF. Make sure to indicate which dependency you

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论