Chapter 9 Database Planning, Design, and Administration Sungchul Hong.
Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER)...
-
Upload
ami-ferguson -
Category
Documents
-
view
216 -
download
1
Transcript of Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER)...
![Page 1: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/1.jpg)
Chapter 11 (I)
CIS458
Sungchul Hong
![Page 2: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/2.jpg)
Chapter 11 - Objectives• How to use Entity–Relationship (ER) modelling in database design.
• Basic concepts associated with ER model.
• Diagrammatic technique for displaying ER model using Unified Modelling Language (UML).
• How to identify and resolve problems with ER models called connection traps.
• How to build an ER model from a requirements specification.
![Page 3: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/3.jpg)
Entity-Relationship Model
• ER modeling is a top-down approach to database design.
• Unified Modeling Language
![Page 4: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/4.jpg)
ER Diagram of Branch View of DreamHome
![Page 5: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/5.jpg)
Concepts of the ER Model
• Entity types
• Relationship types
• Attributes
![Page 6: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/6.jpg)
Entity Type
• Entity type– Group of objects with same properties,
identified by enterprise as having an independent existence.
• Entity occurrence– Uniquely identifiable object of an entity type.
![Page 7: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/7.jpg)
Entity Type & Entity Occurrence
Employee Company
![Page 8: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/8.jpg)
Examples of Entity Types
![Page 9: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/9.jpg)
ER Diagram of Staff and Branch Entity Types
![Page 10: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/10.jpg)
Entities (EX)
• A college is divided into several schools.• Each school is administered by a dean.• A dean is a professor• Each school is composed of several departments.• Each department offers several courses.• A course can have many sections • Each professor may teach up to four classes,
each one a section of a course. A professor may also be on a research contract and teach no classes at all.
![Page 11: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/11.jpg)
Relationship Types
• Relationship type– Set of meaningful associations among entity
types.
• Relationship occurrence– Uniquely identifiable association, which
includes one occurrence from each participating entity type.
![Page 12: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/12.jpg)
Semantic Net of Has Relationship Type
Branch has staff
![Page 13: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/13.jpg)
ER Diagram of Branch Has Staff Relationship
![Page 14: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/14.jpg)
Relationship Types
• Degree of a Relationship– Number of participating entities in relationship.
• Relationship of degree:– two is binary;– three is ternary;– four is quaternary.
![Page 15: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/15.jpg)
Binary Relationship called POwns
![Page 16: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/16.jpg)
Ternary Relationship called Registers
![Page 17: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/17.jpg)
Question
• Can three binary relationships substitute a ternary relationship? (In general)
![Page 18: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/18.jpg)
Quaternary Relationship called Arranges
![Page 19: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/19.jpg)
Relationship Types
• Recursive Relationship– Relationship type where same entity type
participates more than once in different roles.
• Relationships may be given role names to indicate purpose that each participating entity type plays in a relationship.
![Page 20: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/20.jpg)
Recursive Relationship called Supervises with Role Names
![Page 21: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/21.jpg)
Entities associated through two distinct Relationships with Role Names
![Page 22: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/22.jpg)
Attributes
• Attribute– Property of an entity or a relationship type.
• Attribute Domain– Set of allowable values for one or more
attributes.
![Page 23: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/23.jpg)
Attributes• Simple Attribute
– Attribute composed of a single component with an independent existence.
• Composite Attribute– Attribute composed of multiple components,
each with an independent existence.
![Page 24: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/24.jpg)
Attributes• Single-valued Attribute
– Attribute that holds a single value for each occurrence of an entity type.
• Multi-valued Attribute– Attribute that holds multiple values for each
occurrence of an entity type.
![Page 25: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/25.jpg)
Attributes
• Derived Attribute– Attribute that represents a value that is
derivable from value of a related attribute, or set of attributes, not necessarily in the same entity type.
![Page 26: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/26.jpg)
car1((ABC 123, TEXAS), TK629, Ford Mustang, convertible, 1999, (red, black))
car2
((ABC 123, NEW YORK), WP9872, Nissan 300ZX, 2-door, 2002, (blue))car3
((VSY 720, TEXAS), TD729, Buick LeSabre, 4-door, 2003, (white, blue))
.
.
.
CARRegistration(RegistrationNumber, State), VehicleID, Make, Model, Year, (Color)
![Page 27: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/27.jpg)
Keys• Candidate Key
– Minimal set of attributes that uniquely identifies each occurrence of an entity type.
• Primary Key– Candidate key selected to uniquely identify each
occurrence of an entity type.
• Composite Key– A candidate key that consists of two or more attributes.
![Page 28: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/28.jpg)
Primary Key (EX)
• staffNo, name, position salary, totalStaff
• branchNo, address {street, city, zip code, telephone number[1..3]}
• Patient number, patient name, drug number, drug name, description, dosage, method of admin, units per day, start date, finish date.
![Page 29: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/29.jpg)
ER Diagram of Staff and Branch Entities and their Attributes
![Page 30: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/30.jpg)
Entity Type• Strong Entity Type
– Entity type that is not existence-dependent on some other entity type.
• Weak Entity Type– Entity type that is existence-dependent on
some other entity type.
![Page 31: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/31.jpg)
Strong Entity Type called Client and Weak
Entity Type called Preference
![Page 32: Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.](https://reader036.fdocuments.in/reader036/viewer/2022062801/56649e7d5503460f94b7fbca/html5/thumbnails/32.jpg)
Relationship called Advertises with Attributes
N P D C
N1 P1 1 10
N1 P2 1 10
N2 P1 1 20