You are on page 1of 36

Course : ISYS6169 – Database Systems

Year : 2021

ENTITY RELATIONSHIP
MODELING

Session 11
LEARNING OUTCOME

LO 3: Design database using structured


data model
ACKNOWLEDGEMENT

These slides have been


adapted from Thomas
Connolly and Carolyn Begg.
2015. Database Systems: A
Practical Approach To
Design, Implementation, and
Management. Pearson
Education. USA. ISBN:978-1-
292-06118-4
CHAPTER 12
ENTITY RELATIONSHIP MODELING
LEARNING OBJECTIVES
Student able to create entity relationship diagram by
defining:
• Basic concepts associated with ER model.

• Diagrammatic technique for displaying ER model


using Unified Modeling Language (UML).
• Problems with ER Models

Bina Nusantara
4 Components in ER-Modeling

• Entity/ Entity Type


• Relationship
• Attribute
• Multiplicity

Customer Order

custID orderID
custName 1 0..* orderDate
address amount
email
Entity is a group of objects with the same
properties, which are identified by the
enterprise as having an independent existence.

A uniquely identifiable object of an entity is


referred as an entity occurrence

Customer Order Product


Places Consists of

Relationship is a set of meaningful


associations among entities
DEGREE OF RELATIONSHIP

The number of participating entity types in a relationship


3 Types of Relationship

Binary Association
(Degree = 2)
Customer Order
Places

Customer places order


Ternary relationship called
Registers (Degree = 3)
Quaternary relationship
called Arranges (Degree = 4)
Recursive relationship called
Supervises with role names

Relationship type where same entity type participates more


than once in different roles.
Attributes

• Attribute
– Property of an entity or a relationship type.

• Attribute Domain
– Set of allowable values for one or more
attributes.

Customer
custID {PK}
custName
address Attribute and
street Attribute Domain
city
telNo [1..3]
email
Types of Attributes
• Attribute composed of a single
Simple component with an independent
Attribute existence

• Attribute composed of multiple


Composite components, each with an independent
Attribute existence.

Single-valued • Attribute that holds a single value for


Attribute each occurrence of an entity type.

Multi-valued • Attribute that holds multiple values for


Attribute each occurrence of an entity type.

• Attribute that represents a value that is


Derived derivable from value of a related
Attribute attribute, or set of attributes, not
necessarily in the same entity type.
Keys
addriana1.wordpress.com

• Candidate Key
– Minimal set of attributes that uniquely identifies
each occurrence of an entity type.
– Example: custID, email in Customer table

• Primary Key
– Candidate key selected to uniquely identify each
occurrence of an entity type.
– Example: custID in Customer table
• Composite Key
– A candidate key that consists of two or more
attributes.
Attributes and Key from
Customer, Order, and Product

Primary
Key

Customer
Order Product
custID {PK} Consist of
custName Places
orderID {PK} productID {PK}
address orderDate productName
street custID price
city amount availability
telNo [1..3]
email
Simple
Single and Attribute
Composite
Multi-valued
Attribute
Attribute
Attributes and Key from Dreamhome
Case : Staff and Brach
Strong vs Weak Entity

Entity that is not Entity that is


existence-dependent existence-dependent
on some other entity. on some other entity
Multiplicity

• Main type of constraint on relationships is called


multiplicity.
• Multiplicity - number (or range) of possible
occurrences of an entity type that may relate to
a single occurrence of an associated entity type
through a particular relationship.
• Represents policies (called business rules)
established by user or company.
Multiplicity

Multiplicity is number of possible occurrences of an entity type that may


relate to a single occurrence of an associated entity through a particular
relationship
Multiplicity

• 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 (*:*)

www.c-jump.com
Multiplicity of Staff Manages
Branch (1:1) relationship
Multiplicity of Staff Oversees
PropertyForRent (1:*) relationship type
Multiplicity of Newspaper Advertises
PropertyForRent (*:*) relationship
Structural Constraints Multiplicity

• Cardinality
– Describes maximum number of possible
relationship occurrences for an entity
participating in a given relationship type.
• Participation
– Determines whether all or only some entity
occurrences participate in a relationship.
– Can be Optional (0) or Mandatory (1).
Structural Constraints Multiplicity
Problems with ER Models

• Problems may arise when


designing a conceptual data
model called connection traps.
• Often due to a
misinterpretation of the
meaning of certain
relationships.
• Two main types of connection
traps are called fan traps and
chasm traps.

thethoughtgardener.com
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.
Fan Trap

At which branch office does staff number SG37


work?
Fan Trap Solution

SG37 works at branch B003


Chasm Trap

At which branch office is property PA14 available?


Chasm Trap Solution

www.quadrobay.com
Chasm Trap Solution
Cutiebabyshop

Cutie Baby Shop is an online baby shop that sell baby products
(clothes, shoes, toys, baby feeding set, bag, blanket, baby bath set,
accessories, and so on) online through their website
www.cutiebabyshop.com. Now, Cutie Baby Shop wants to expand their
business and launch mobile application which called Cutiebabyshop
that can be download free in application store. The business process in
Cutiebabyshop is stared when customer wants to buy the products.
User must register as a member in Cutiebabyshop mobile app by fill
identity such as name, address, gender, phone number, and email. After
registration, member can select the items and put in the shopping cart
,then system will automatically update the item stock in the database.
After finish put items in the shopping cart and press finish button, the
application user interface will display the recap of the member’s items
which include the total price, then member can choose delivery type
(JNE JNE Oke = 3-7 days, JNE Regular = 2-4 days, dan JNE Yes = 1-2 days,
and also several payment methods, such as transfer through internet
banking or credit card.
Cutiebabyshop

If member wants to pay by using transfer, then member must


choose the bank and systems will connect member directly to the bank’s
internet banking website to do the transaction. If member choose credit
card payment method, member can use credit card from any kind of
bank as long as the card is Visa or Master Card by input credit card
number.
After member completes payment transaction, Cutiebabyshop will
send the items to member’s address, then member can check delivery
status on the application. Systems will update member transaction
status become “sent” which means items already send to the member.

Create Entity Relationship Modeling from This Case !


www.healthytravelblog.com

You might also like