Lecture 4 Creating Entity Relationship Diagram ERD (1)
Lecture 4 Creating Entity Relationship Diagram ERD (1)
Relationship Diagram
(ERD)
Basic Format/ Crow’s Foot Format
What are the things to Prepare?
• Scheme and knowing it (scenario or actual problem)
• Pin-pointing the entities
• Describing or identifying the attributes
• Highlighting the Key Attribute
- Primary key
- Foreign key
• Determining the Relationship
Moreover with ERD Concepts
• ERD – represents the conceptual database as viewed by the end user. ERD depicts the databases
main components: entities, attributes and relationships.
• Components of ERD:
• Entities – an object of interest of the end user.
In ERM, it refers to a specific table row as an entity instance or entity
occurrence.
• Attributes – characteristics of the entity.
For example, the STUDENT entity includes the attributes STU_LNAME,
STU_FNAME, and STU_INITIAL.
• Domains – attribute’s set of possible values.
For example, SEX consists of only two possibilities M or F. Others that may
have domain like date, average, grades, etc.
• Identifier keys – uniquely identify each entity instance.
1.Primary key – a candidate key selected as a unique identifier.
2.Foreign key – an attribute (or combination of attributes) in one table whose values match
the primary key in another table or whose values must not be null.
3.Composite Primary key – a primary key composed of more than one attribute
Attributes
• Composite and Simple Attributes
1. Composite Attribute – is an attribute that can be further
subdivided to yield additional attribute.
2. Simple Attribute - is an attribute that cannot be subdivided.
3. Single – valued attribute – is an attribute with a single value.
4. Multivalued Attributes – an attribute that can have several
values.
Relationship
Connectivity and Cardinality
• Cardinality– expresses the minimum and maximum number of entity
occurrences associated with one occurrence of the related entity. In
ERD, cardinality is indicated by placing the appropriate numbers beside
the entities using the format (x,y): x – minimum value and y-for the
maximum value.
• Connectivity – describes the classification of the relationship between
entities: 1:1, 1:M, or M:M.
• Existence Dependence – it can exist in the database only when it is
associated with another entity occurrence. It has a mandatory foreign
key, a foreign key whose values cannot be null.
• Relationship Participation
• Optional Participation (0)
• - Means that one entity occurrences does not require a corresponding entity occurrence
in a particular relationship.
• Mandatory Participation(1)
• - Means that one entity occurrence requires a corresponding entity occurrence in a
particular participation.
• Relationship degree
• -Indicates the number of entities or participants associated with a relationship
• - Unary relationship – exist when a association is maintained within a single entity. Such
a relationship is known as Recursive Relationship.
• - Binary relationship – exist when two entities are associated.
• - Tertiary relationship – exist when three relationships are associated.
• - Higher degree relationship –type of relationship that is more than three entities are
involve.
Sample Scenario:
• Bookstore
- In a bookstore, a store manager
manages everything on its daily process.
A store manager keeps track of
borrowed book, inventory, and sold
books. The manager performs basic to
complex function like computing the
sales and publishing reports.
The following are just samples attributes that you can identify.
It is subjective to changed during implementing ERD.
Sample
ERD
Output
TAKE NOTE:
• It is not mandatory if you are not using a ERD Tool (e. g. Visio, UML, etc.) to
have Weak Relationship. A straight association line will do.