数据库管理系统概述英文版课件:tutorial1 ER Diagrams_第1页
数据库管理系统概述英文版课件:tutorial1 ER Diagrams_第2页
数据库管理系统概述英文版课件:tutorial1 ER Diagrams_第3页
数据库管理系统概述英文版课件:tutorial1 ER Diagrams_第4页
数据库管理系统概述英文版课件:tutorial1 ER Diagrams_第5页
已阅读5页,还剩24页未读 继续免费阅读

下载本文档

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

文档简介

1、COMP231 Tutorial 1ER DiagramsE-R DiagramRectangle entity set实体集Ellipse attribute属性Diamond 菱形 relationship set 联系集Double ellipse multivalued attribute 多值Dashed ellipse derived attribute派生属性Double line total participationDouble rectangle weak entity setDouble diamond relationship set for weak entity s

2、etExercise 1A university registrars office maintains data about the following entities: course, including number, title, credits, syllabus, and prerequisites; course offering, including course number, year, semester, section number, instructor(s), timings, and classroom; student, including student-i

3、d, name, and program;instructor, including identification number, name, department, and title. Further, the enrollment of students in courses and grades awarded to students in each course they are enrolled for must be appropriately modeled.Construct an E-R diagram for the registrars office. Document

4、 all assumptions that you make about the cardinality constraints and participation constraints.Entity sets“A university registrars office maintains data about the following entity sets:” (a) course (b) course offering (c) student (d) instructorcoursecourse-offeringstudentinstructorCourse“course incl

5、uding number, title, credits, syllabus, and prerequisites”Entity set?Attribute?Relationship set? Roles?Cardinality constraint?Participation constraint?prerequisitemaincoursecourse_notitlerequirescoursesyllabuscredits“course offering, including course number, year, semester, section number, instructo

6、r(s), timings, and classroom”Course Offeringtimeroomcoursesection_nosemesteryearcourse- offeringis offeredCourse-noWeak Entity SetA weak entity set can be identified uniquely only by considering the primary key of another (owner) entity setOwner entity set and weak entity set must participate in one

7、-to-many relationship set (one owner, many weak entities).Weak entity set must have total participation in this identifying relationship set. Difference between weak entity and existence dependencyWE implies ED but not the other way round. WE has only a partial key but ED may have a primary key BABA

8、BAStudent, Instructor“student, including student-id, name, and program”“instructor, including identification number, name, department, and title”studentnamesidprograminstructortitledeptnameiidEnrollment“Further, the enrollment of students in courses and grades awarded to modeled. students in each co

9、urse they are enrolled for must be appropriately ”studentcourse-offeringenrolsgradeExercise 1A university registrars office maintains data about the following entities: course, including number, title, credits, syllabus, and prerequisites; course offering, including course number, year, semester, se

10、ction number, instructor(s), timings, and classroom; student, including student-id, name, and program;instructor, including identification number, name, department, and title. Further, the enrollment of students in courses and grades awarded to students in each course they are enrolled for must be a

11、ppropriately modeled.Construct an E-R diagram for the registrars office. Document all assumptions that you make about the cardinality constraints and participation constraints.Anymore ?Instructor teaches course.instructorteachescourse-offeringA course-offering does not have to have an instructor.A c

12、ourse-offering has to have an instructor. Partial participationTotal participationtitledeptnameiidFigure 1 E-R diagram for a university registrar office.prerequisitemaincoursecoursesyllabuscreditstimeroomsection_nosemesteryearcourse- offeringis offeredenrollsgradenamesidprogramstudentinstructorteach

13、estitlerequirescourse_noMore Based on Figure 1 , modify the E-R Diagram so as to present the following information. Each instructor must belong to exactly one department. Each department includes dept-id, name, telephone number. Each department must have at least one instructor.DepartmentEach instru

14、ctor must belong to exactly one departmentEach department must have a least one instructor.instructordepartmentbelongstelephone numberdept-idnameExercise 2Design a database to organize the information about a factory and the products that are manufactured there. The relevant information is as follow

15、s:The factory has a number of employees. For each employee you need to store the name, employee number, and salary.Each employee must be an administrative staff or a worker, but not both.Administrative employees must take seminars. For each seminar we keep its id, name and date. For the administrati

16、ve staff, you must store the grade received, for each seminar taken.The factory manufactures a number of products and each product is identified by a product id and has a name. A worker is assigned to work on exactly one product; a product has multiple (one or more) workers assigned to it. A large n

17、umber of items are manufactured for each product. Each item has a serial number and a color. Different items of the same product have different serial numbers. However, two items that belong to different products may have the same serial number.Exercise 2Design a database to organize the information

18、 about a factory and the products that are manufactured there. The relevant information is as follows:The factory has a number of employees. For each employee you need to store the name, employee number, and salary.分类 Each employee must be an administrative staff or a worker, but not both.Administra

19、tive employees must take seminars. For each seminar we keep its id, name and date. For the administrative staff, you must store the grade received, for each seminar taken.The factory manufactures a number of products and each product is identified by a product id and has a name.relationship A worker

20、 is assigned to work on exactly one product; a product has multiple (one or more) workers assigned to it. A large number of items are manufactured for each product. Each item has a serial number and a color. Different items of the same product have different serial numbers. However, two items that b

21、elong to different products may have the same serial number.Employee, Administrative staff, WorkerThe factory has a number of employees. For each employee you need to store the name, employee number, and salary.Each employee must be an administrative staff or a worker, but not both.ISAEmployeeAdmini

22、strative staffWorkerSeminarAdministrative employees must take seminars. For each seminar we keep its id, name and date. For the administrative staff, you must store the grade received, for each seminar taken.Administrative staffTakesSeminarProductThe factory manufactures a number of products and eac

23、h product is identified by a product id and has a name. A worker is assigned to work on exactly one product; a product has multiple (one or more) workers assigned to it. WorkerWorks forProductItemA large number of items are manufactured for each product. Each item has a serial number and a color. Di

24、fferent items of the same product have different serial numbers. However, two items that belong to different products may have the same serial number.ItemProductFormsISAEmployeeAdministrative staffWorkerTakesSeminarWorks forProductItemFormsConclusionNotations of E-R DiagramGenerally, we construct an

25、 E-R diagram, by identifying: Entity setsWhat should be entities? Strong or weak entity set?Relationship setsNeed to label roles?AttributesCan be inherited? (generalization or specification)Participation constraints:Total participation or partial participation?Cardinality constraintsOne to one, one

26、to many or many to many?ororQ&AExampleWe want to create database for a bank in which we store: Customers (id, name, city). Accounts (number, balance)Loans (number, amount)Branches (name, city, assets)Each customer can have any number of accounts and loansEach account and loan is associated with one

27、branch. A customer must have either one account or loan in order to be in the databaseThe balance in each account should be $100. The last two constraints cannot be expressed by the ER diagram.SolutionParticipation constraintCardinality constraintExampleWe want to create a very simple database for S

28、CUT in which to record information about professors, students and classes. For each professor we need to store the HK-id, name and office number. For each student we need to store the student-id and nameFor each class the id (e.g., COMP 231) and the name. Each class is taught by exactly one professor.Each student must take at least one class. For each class

温馨提示

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

评论

0/150

提交评论