03) Data Modeling With ERD
03) Data Modeling With ERD
Two
perspectives
Top-down Bottom-up
M N
Member Searches Books
Data entities
Relationships Chen Model & Crow’s Foot Model
Attributes
Entities
Examples of entities:
CANDIDATE KEY
• Attribute (or combination of attributes) that uniquely identifies each
instance of an entity type
• Some entities may have more than one candidate key
• Ex: A candidate key for EMPLOYEE is Employee_ID, a second is the
combination of Employee_Name and Address.
• If there is more than one candidate key, need to make a choice.
Identifier
Referential attribute: Ties the lecturer entity to another entity that is department.
EntityName
EntityName Verb phrase
List of Attributes
Acceptable
Chen Notation
Association between the instances
of one or more entity types
Verb
EntityName Phrase AttributeName
Represents a set or collection of objects in the real world that share the same properties
08-08-2024 Lecture Presentation | © Dr. A. K. Kar 14
08-08-2024 Lecture Presentation | © Dr. A. K. Kar 15
Developing an ERD for System Specification
Relationship name:
writes
Author Book
Connectivity
1 M
Professor teaches Class
(1,1) (1,3)
Cardinality
Connectivity
many
One or many
Optional? – we’ll see after this
Binary Relationships
• 1:M relationship
– Relational modeling ideal
– Should be the norm in any relational database design
• 1:1 relationship
– Should be rare in any relational database design
– A single entity instance in one entity class is related to a single entity instance in
another entity class
– Could indicate that two entities actually belong in the same table
The 1:1
Relationship
Between
PROFESSOR
and
DEPARTMENT
Binary Relationships
• M:N relationships
– Must be avoided because they lead to data redundancies.
– Can be implemented by breaking it up to produce a set of 1:M
relationships
– Can avoid problems inherent to M:N relationship by creating a
composite entity or bridge entity
• This will be used to link the tables that were originally related
in a M:N relationship
• The composite entity structure includes-as foreign keys-at least
the primary keys of the tables that are to be linked.
The M:N Relationship Between STUDENT and CLASS
Mandatory Optional
handles
Professor Course
(1,1) (0,N)
M
1
Professor handles Course
(0,N) (1,1)