Professional Documents
Culture Documents
Objectives
How to use EntityRelationship (ER) modeling in
database design.
Basic concepts associated with ER model. Diagrammatic technique for displaying ER model using
Unified Modeling Language (UML).
specification.
Models business,
not implementation Is a well-established technique Has a robust syntax Results in easy-to-read diagrams
# CODE * DESCRIPTION
defi ned by
appli ed to
ORGANIZATION
o * o o o o o o o EMAIL NAME POSTAL CODE REGION STREET TOWN TELEPHONE NUMBER CONTACT NAME CONTACT EXTENSION
part of
at
T IT LE MOVIE
# PRODUCT CODE * CATEGORY * TITLE o AGE RATI NG o DESCRI PTION * DURATION * MONOCHROME o AUDIO o PREVIEW
GAME
the fo
SUPPLIER
# SUPPLIER CODE o EMAIL APPROVED REFERENCE
for
PRICE HISTORY
# EFFECTIVE DATE * PRI CE * DEFAULT DAYS * OVERDUE RATE
on
PUBLICAT ION
# * o o o REFERENCE TITLE VOLUME ISSUE PUBLI SH DATE
CATALOG
# REFERENCE o CATALOG DATE o DESCRI PTION
the holder o f
CUST OMER
o * * * o * * * * o o o o o
managed by EMPLOYEE
* * o o o POSITION LAST NAME FIRST NAME OTHER INITIALS EMAIL
the manager of
of
COPY
acquired fro m
EMAIL DESIGNATION FIRST NAME LAST NAME OTHER INITIALS STREET TOWN POSTAL CODE REGION HOME PHONE WORK EXTENSION WORK PHONE PHOTOGRAPH STAFF REMARKS
rented on reserved on
held by in in
REVIEW
# * * o o SEQUENCE ARTICLE HOT AUTHOR URL
held by
of
MEMBERSHIP
# NUMBER o TERMINATION REASON o TERMINATION DATE
the type o f of
approved by
renewed fo r authorized by of requested against the MEMBERSHIP PERIOD requestor # START DATE o ACTUAL FEE PAI D of approved by
used fo r
BOOKING
* o o o o BOOK DATE EXPIRE DATE NOTIFY DATE RESERVE DATE STAFF REMARKS
ful fi ll ed as
RENT AL
* RENTAL DATE o STAFF REMARKS o COMPLETED
for
composed of for
RENT AL IT EM
# LINE NO * RENTAL PERIOD * PRI CE PAI D o RETURN DATE o STAFF REMARKS
part of
Database Types
ER Model
Hierarchical Relational
Network
Entity Type
Entity type
Group of objects with same properties, identified by enterprise as having an independent existence. Something of significance to the business about which data must be known A name for the things that you can list Usually a noun
Entity occurrence/instances
Mahatma Gandhi 2.5 x 35 mm copper nail nail my previous contract violinist fluent tonight: Hamlet in the Royal the CD I bought yesterday for parliament next fall ...
11
13
Relationship Types
Relationship type
Set of meaningful associations among entity types. Express how entities are mutually related Always exist between two entities (or one entity twice)
Relationship occurrence
Uniquely identifiable association, which includes one occurrence from each participating entity type.
15
Relationship Examples
EMPLOYEES have JOBS JOBS are held by EMPLOYEES
PRODUCTS are classified by a PRODUCT TYPE
PRODUCT TYPE is a classification for a PRODUCT
ORDER
TICKET RESERVATION
JOB ASSIGNMENT
waiter
Numerical observation: All EMPLOYEES have a JOB No EMPLOYEE has more than one JOB
19
20
Relationship Types
Degree of a Relationship
Number of participating entities in relationship.
Relationship of degree:
two is binary; three is ternary; four is quaternary.
21
22
23
24
Relationship Types
Recursive Relationship
Relationship type where same entity type participates more than once in different roles.
25
26
27
Attributes
Attribute
Also represents something of significance to the business Is a specific piece of information that: Describes Quantifies Qualifies Classifies Specifies an entity
Property of an entity or a relationship type.
Attribute Domain
Set of allowable values for one or more attributes.
28
Attribute Examples
Entity EMPLOYEE
CAR ORDER JOB TRANSACTION EMPLOYMENT CONTRACT Attribute Family Name, Age, Shoe Size, Town of Residence, Email, ... Model, Weight, Catalog Price, Order Date, Ship Date, Title, Description, ... Amount, Transaction Date, Start Date, Salary, ...
Entities with their Attributes USER - Address - Password PERSON - Name - Birth Date - Occupation COUNTRY - Name MESSAGE - Text ATTACHMENT - Filename FOLDER - Name
Attributes in Diagrams
Mandatory attribute, that is, known and available for
every instance.
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. Example: address (simple attribute) can be subdivided into attributes of street, city, postcode
32
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. Eg: telephoneNo
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.
33
Keys
Candidate Key
Minimal set of attributes that uniquely identifies each occurrence of an entity type.
Primary Key
Composite Key
A candidate key that consists of two or more attributes.
34
35
Entity Type
Entity type that is not existence-dependent on some other entity type. Characteristic: Each entity occurrence is uniquely identifiable using PK attribute of the entity type
Strong Entity Type called Client and Weak Entity Type called Preference
37
38
Structural Constraints
Main type of constraint on relationships is called
multiplicity.
occurrences of an entity type that may relate to a single occurrence of an associated entity type through a particular relationship. user or company.
39
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 (*:*)
40
41
42
43
44
45
46
Structural Constraints
Multiplicity for Complex Relationships
Complex relationship relationship higher than binary Number (or range) of possible occurrences of an entity type in an n-ary relationship when other (n-1) values are fixed.
47
Semantic Net of Ternary Registers Relationship with Values for Staff and Branch Entities Fixed
48
50
Structural Constraints
Cardinality
Describes maximum number of possible relationship occurrences for an entity participating in a given relationship type. Appears as the maximum values for the multiplicity ranges on either side of the relationship
51
Structural Constraints
Participation (mandatory/optional)
determines whether all or only some entity occurrences are involved/participate in a relationship. All is mandatory (minimum value 1) ; only some is optional (minimum value 0) How to determine an entitys participation on a diagram? Look at the minimum value of a range at one entity. If value is 0, then the opposite entity (in that relationship) has a optional participation If value is 1, then the opposite entity (in that relationship) has a mandatory participation
52
53
Structural Constraints
Why need to understand and able to differentiate
between the different type of structural constraints in data model (ERD)?
Relational schemas will be created from entities-relationship in ERD Different type of constraints will affect the schemas created (will be discussed in logical database design topic)
54
55
0..*
0..*
56
57
58
Problem 4
The IT Training Group (Glasgow) has contacted you to create a
conceptual model by using the EntityRelationship data model for a database that will meet the information needs for its training program. The Company Director gives you the following description of the training groups operating environment. The Company has twelve instructors and can handle up to one hundred trainees per training session. The Company offers five advanced technology courses, each of which is taught by a teaching team of two or more instructors. Each instructor is assigned to a maximum of two teaching teams or may be assigned to do research. Each trainee undertakes one advanced technology course per training session. Given this information, draw an ER diagram for IT Training Group (Glasgow).
59
Solution Problem 4
Assigned IsPartOf
Research
0..* 1..1
Instructor
1..1 0..2
TeachingTeam
1..1
Teaches
1..*
Attends
Provides
Trainee
1..1 1..*
Training
1..* 1..1
Advanced Course
Session
60
61