September 6, 2017 Sam Siewert
CS317File and Database Systems
Lecture 2 – Basic ER ModelsPart-2
http://dilbert.com/strips/comic/2012-08-14/
Reminders…Assignement #1, Due Today
Late Due Date (10% penalty) is Monday
Assignment #2, Available on Sunday Morning
Sam Siewert 2
DBMS Analysis and Design
Basic ER-Models
Sam Siewert
3
For Discussion…SA/SD – Focused on Dataflow and Structure
1. SA/SD Included a Data Dictionary which is Data on Data (Meta-data) that describes DBMS Tables (the Schema)
2. Entities in a DBMS ERD Contain Meta-data
3. Chen’s Goal in 1976 with the Entity Relationship Model Was to Show the Structure of Relations and Cardinality
4. Work in DBMS at the time Was Normalization of Relational Models (Elimination of Redundant Data in Tables, Related through Foreign Keys)
5. Compare to Relational Model, Network Model, Hierarchical Model (pages 46-49 in Connolly-Begg - Scanned and Uploaded to Canvas)
6. UML – ER Model comparable to UML Class Diagram (not identical), EER (Enhanced ER Model) for Superclass and Subclass Relationships
Sam Siewert 4
DBMS Development Lifecycle
ER Models - DBMS Chapter 2
Sam Siewert
5
DreamHome ER ModelCompare to DreamHome Relational Model
Sam Siewert 6
Tables
1) Staff2) Branch3) Registration
(Ternary Registers)
• Lease4) Client• Preference5) PropertyForRent• Newspaper6) PrivateOwner• Business Owner7) Viewing
(Conceptual)
7
Examples of Entity Types
8
Semantic net of Has relationship type
9
ER diagram of Branch Has Staff relationship
10
Relationship Types
Degree of a Relationship– Number of participating entities in relationship.
Relationship of degree :– two is binary – three is ternary– four is quaternary.
11
Ternary relationship called Registers
12
Quaternary relationship called Arranges
E.g. Staff arranges a Viewing on behalf of a PrivateOwner supported by a Branch
13
ER diagram of Staff and Branchentities and their attributes
DreamHome SchemaWorking Example DB from old Textbook
Can Create from DreamHome version 1.0
Used in Examples in Class
Sam Siewert 14
15
Strong entity type called Client and weak entity type called Preference
16
Relationship called Advertises with attributes
17
Structural Constraints
The most common degree for relationships is binary.
Binary relationships are generally referred to as being:– one-to-one (1:1)– one-to-many (1:*)– many-to-many (*:*)
18
Semantic net of Staff Manages Branchrelationship type
19
Multiplicity of Staff Manages Branch(1:1) relationship
20
Semantic net of Staff Oversees PropertyForRent relationship type
21
Multiplicity of Staff OverseesPropertyForRent (1:*) relationship type
22
Semantic net of Newspaper AdvertisesPropertyForRent relationship type
23
Multiplicity of Newspaper AdvertisesPropertyForRent (*:*) relationship
24
Semantic net of ternary Registersrelationship with values for Staff and
Branch entities fixed
25
Multiplicity of ternary Registersrelationship
26
Summary of multiplicity constraints
27
Multiplicity as cardinality and participation constraints
28
Problems with ER Models
Fan Trap– Where a model represents a relationship between entity types, but
pathway between certain entity occurrences is ambiguous.
Chasm Trap– Where a model suggests the existence of a relationship between
entity types, but pathway does not exist between certain entity occurrences.
29
An Example of a Fan Trap
30
Semantic Net of ER Model with Fan Trap
At which branch office does staff number SG37 work?
31
Restructuring ER model to remove Fan Trap
32
Semantic Net of Restructured ER Model with Fan Trap Removed
SG37 works at branch B003.
33
An Example of a Chasm Trap
34
Semantic Net of ER Model with Chasm Trap
At which branch office is property PA14 available?
35
ER Model restructured to remove Chasm Trap
36
Semantic Net of Restructured ER Model with Chasm Trap Removed