You are on page 1of 39

ERD Using Barker Notation

Chapter 4
Entities

2
Attributes

3
Identify Unique Identifier (UID)
• Unique identifier is represented in the entity box
with the hash (pound sign) # symbol

4
Optionality of a Relationship

5
Relationships

6
Relationships
Optionality
• Mandatory
– Solid line in ERD
– MUST in ERDish

• Optional
– Dashed line in ERD
– MAY in ERDish

7
Types of Relationships

8
Relationships
Cardinality
• One occurrence
– Single toe in ERD
– "one and only one" in ERDish
• One or more occurrences
– Crow's foot to denote "one or more" in ERD
– "one or more" in ERDish

9
Relationships

10
Entity-Relationship Diagram
Barker Notation

11
ERDish Language
• ERDish is the language used to state relationships
between entities in an ERD

• Consider EMPLOYEE - DEPARTMENT

12
Relationship
• A relationship:
– Always exist between two entities (or one entity twice)
– Every relationship goes in two directions
 Always has two sides
 Is named at both ends

13
The Components of ERDish
• Each relationship has two sides
• Read the first relationship from left to right

14
The Components of ERDish

15
The Components of ERDish

16
Relationships
• One-to-One (1:1)

• One-to-Many (1:M)

• Many-to-Many (M:M)

17
One-to-One Relationships
• One-to-One (1:1): A relationship where a single
instance in Entity A is related to one and only one
instance in Entity B, and a single instance in Entity
B is related to one and only one instance Entity A

18
One-to-One Relationships
• Mandatory at one end of the 1:1 relationship
commonly occurs when roles are modeled

19
One-to-Many (1:M) Relationships
• One-to-Many (1:M): A relationship where a single
instance in Entity A can be related to one or more
instances in Entity B, but a single instance in Entity
B can only be related to one instance in Entity A

20
Many-to-Many (M:M) Relationships
• Many-to-Many (M:M): A relationship in which many
instances in one entity match many instances in
another entity.
• Many-to-many relationships are typically hiding
another entity

21
Many-to-Many (M:M) Relationships
• M:M relationships are common in the first version
of an ER model
• In later stages of the modeling process, most M:M
relationships, and possibly all, will disappear

22
Resolving Many-to-Many Relationships
• Consider a large company like Wal-Mart that
handles many products and stores them in many
warehouses.

23
Many-to-Many Relationships
• What does this ERD say? It says that Wal-Mart can
only store their pineapples in one of their
warehouses

• Is that normally true?

24
Many-to-Many Relationships
• Now:
– Warehouses may store all products
– All products may be stored in any warehouse

25
Many-to-Many Relationships
• Problem? Where would quantity be stored?
• Many-to-many relationships hide an ENTITY
• Need an intersection entity

26
Intersection Entity
• A third entity called an
intersection entity is
needed to resolve a M:M
relationship

• The original M:M


relationship becomes two
1:M relationships

27
Intersection Entity
• What is the UID of the
Intersection entity?

28
Barred Relationship
• The unique identifier of the intersection entity
comes from the original relationships
• Represented by bars
• The relationship from the original entities to the
intersection entity are called "barred relationships"

29
Intersection Entity

30
Unique Identifiers

31
UIDs from Barred Relationships

32
UIDs from Barred Relationships

33
The End

34
Let's Try It

35
M:M - Let's Try It

36
Barred: Let's Try It

37
Unique ID: Let's Try It

38
Unique Identifiers

OR

39

You might also like