Module 4
Module 4
Organization (cont.)
Database Management System I
Objectives of this Chapter
• Define the key terminologies used in data modeling.
• Enumerate the different components of an ER Diagram.
• Differentiate and model the different types of entities, relationships,
attributes, and cardinalities.
• Distinguish the three degrees of relationship.
• Enumerate the cardinalities of relationship.
• Draw an example of a simple ER Diagram used in a realistic business
situation.
Components of an ER Diagram
2. Attribute
• Refers to the property or characteristic that describes an entity or
relationship type.
ENTITY NAME
Identifier
Partial Identifier
ATTRIBUTE SYMBOLS Optional
[Derived]
{Multivalued}
Composite ( , , , )
Classifications of Attributes
• Required vs. Optional Attributes
• Identifier Attributes
Examples of the Attributes
An Entity that has a COMPOSITE An Entity that has a MULTIVALUED and
ATTRIBUTE DERIVED ATTRIBUTE
STUDENT EMPLOYEE
Student_No. Employee_ID
Student_Name Employee_Name
Student_Address (Street, Employee_Address
Brgy, City, Province, Date_Employed
Postal_Code) Position
Birthday Multivalued Attribute {Skill}
Contact_Number [Years_Employed] Derived Attribute
Characteristics of an Identifier
• An identifier should always have a value.
STUDENT FLIGHT
Student_No. Flight_ID
Student_Name (Flight_Number, Date)
Student_Address (Street, Number_of_Passengers
Brgy, City, Province, Location
Postal_Code)
Birthday
Contact_Number
Components of an ER Diagram
3. Relationship
• Relationship type –category of relationship
STUDENT
Many-to-Many Relationship
Relationship
3. Relationship
• Relationship instance – refers to the link between entities
STUDENT SUBJECT
Angela Java
Mark C++
Nicole Web
James SQL
• One-to-Many
• An entity on one side of the relationship can have many related entities, but an entity on the other
side will have a maximum of one related entity.
• Each record of a particular table can be related to one or more than one record of the other table.
• Many-to-Many
• Entities on both sides of the relationship can have many related entities on the other side.
• Each record of the table can be related to one or more than one record of the other table and vice
versa.
Degrees of Relationships
• Refers to the number of entity types involved in the relationship
UNARY BINARY
RELATIONSHIP RELATIONSHIP
- Involves an entity - Composed of two
which is related to different entity types
the same entity type. related to each other.
TERNARY
RELATIONSHIP
- Composed of three
different entity types
related to each other.
Examples of the Degrees of Relationships
• Unary Relationship
is_married_to manages
composes
is_assigned_to treats
EMPLOYEE DEPARTMENT DOCTOR PATIENT
enrolls
STUDENT SUBJECT
MANY-TO-MANY RELATIONSHIP
Examples of the Degrees of Relationships
• Ternary Relationship
enrolls
STUDENT SUBJECT
INSTRUCTOR
MANY-TO-MANY RELATIONSHIP
Cardinality Constraints
• Indicates the number of instances of an entity that can or must be
associated with the instance of another entity type.
• Minimum Cardinality
• Optional - Zero
• Mandatory – one or more
• Maximum Cardinality
• Maximum number
Relationship Cardinality
MANDATORY
ONE
MANDATORY
MANY
OPTIONAL
ONE
OPTIONAL
MANY
Examples of Cardinality Constraints
• Both sides of the relationship is mandatory
STUDENT SUBJECT
STUDENT SUBJECT
Mark C++
enrolled_by
Nicole Web
James SQL
PATIENT MEDICINE
Mona Aspirin
Vitamin B
Luis
Examples of Cardinality Constraints
• Both sides of the relationship is optional
PERSON
Marie
Jerome
is_married_to
PERSON Paul
Joana
Therese
Gabriel
Example of Multiple Relationship
supervises
prepares prepared_by
FACULTY EXAM
checks checked_by
supervised_by
ER Diagram
offers enrolled_by
contained_in teaches
handled_by
SUBJECT PROFESSOR
handles
Pre-requisites