SlideShare a Scribd company logo
Database Systems (3+1)
Entity Relationship Models
Aakash Ahmad (Lecturer)
Computer Science Dept.
CECOS University of IT and Technology, Peshawar
Contents and Objectives
Contents
● ER Model/ERD
● Design Process
● Modeling
● Constraints
● E-R Diagram
● Design Issues
● Weak Entity Sets
● Extended E-R Features
● Design of the University Database
● Database Design UML
Objectives
To understand ER model
● Design
● ER Modeling
Constraints To understand ER-Diagram
○ Entity
○ Attributes
○ Tuples
○ Associations
Database Design Phases
● The initial phase of database design is to fully characterize the data according to the needs of
database users.
●Next, the designer chooses a data model to translate the requirements into a conceptual
schema of the database.
●The process of moving from a data model to the implementation of the database proceeds in
two final design phases.
●Logical Design – Deciding on the database schema. Database design requires that we find a
“good” collection of relation schemas.
●Physical Design – Deciding on the physical layout of the database.
ER Model
● The ER data model was developed to facilitate database design
●An Entity Relationship Model (E-R Model) is a detailed, logical representation of the
data for an organization or for business area.
●ER Model is used to show the Conceptual Schema of an Organisation. E-R Model is
expressed in three terms:
○ Entities
○ Relationship (or association)
○ Attributes
Entity
●Entity is the basic building block of the Entity Relation Data Model.
●The term Entity is used in three different meanings or for three different terms
and that are:
■ Entity Type
■ Entity Instance
■ Entity Set
Entity Type
●Entity Type: A collection or a set of entities (often corresponds to a table) that shares common properties.
●The Entity Type can be defined as a name/label assigned to items/objects which have similar properties.
● It could be a person, place, object or event about which the organization wishes to maintain data.
●Examples are: Departments, Employees, Students, and Orders etc. To represent an Entity Type in a
Model, use the following conventions:
○ Soft box with rectangle dimensions.
○ Singular, Unique entity name.
○ Entity name in Uppercase.
Entity Instance and Set
● : A single occurrence (existence) of an Entity Type is called Entity Instance.
● For example, following table lists the Entity Types and their defining Properties and Instances.
● Entity Set: A group of Entity Instances of a particular Entity Type is called an Entity Set.
● For example, all employees of an organization form an Entity Set. Like all students, all
courses, all of them form Entity Set of different Entity Types.
Entity Types:
There are two types of Entity Types
Strong/Regular Entity Type
● An Independent Entity. An Entity Type that exists
independently of other Entity Types.
● The Strong Entity Type is also called the Identifying
Owner.
● An Entity Type whose Instances can exist
independently, that is, without being linked to the
Instances of any other Entity Type is called Strong
Entity Type.
● A major property of the Strong Entity Type is that they
have their own identification.
● For example, employee in an organization, is an
independent or Strong Entity Type, since its Instances
can exist independently.
Weak Entity Type/Dependent Entity.
● An Entity Type whose existence depends on another
Entity Type.
● An Entity Type whose Instances cannot exist without
being linked with Instances of some other Entity Type,
i.e., they cannot exist independently.
● For example, in an organization, to maintain data about the
Vehicles owned by the employees. Now a particular Vehicle
can exist in this organization only if the owner already exists
there as employee. Similarly, if an employee leaves the job
and the organization decides to delete the record of the
employee then the record of the Vehicle will also be deleted
since it cannot exist without being linked to an Instance of
employee.
Entity Types:
There are two types of Entity Types
Strong/Regular Entity Type
● Strong entity always has a primary key.
● Strong entity is not dependent on any other entity.
● Strong entity is represented by a single rectangle.
● Relationship between two strong entities is
represented by a single diamond.
Weak Entity Type/Dependent Entity.
● While a weak entity has not a primary key.
● Weak entity depends on strong entity.
● Weak entity is represented by a double rectangle.
● While the relationship between one strong and one
weak entity is represented by a double diamond.
Relationship/Association
●Relationship represents an association between two or more entities.
●Relationships are the connections and interactions between the Entity
Instances.
●Examples are employees and departments, orders and items etc.
○ Symbol of Relationship: Diamond
○ Symbol of Relationship (Weak Relation): Double Diamond
Relationship/Association
●Types/Degree of Relationships/Association:
●A Relationship may consist of many Entity Types.
●The number of Entity Types in a Relationship is called Degree of Relationship.
●The Relationships of Degree 2 are most common and are also called Binary Relationships.
●The Types of Relationships with respect to Degree are as follows:
○ 1. Unary Relationship
○ 2. Binary Relationship
○ 3. Ternary Relationship
●Unary Relationship/Association
●Unary Relationship is a type of Relationship that is established between the
Instances of same Entity Type.
●An Entity Type linked with itself, also called Unary/Recursive Relationship.
●Example: Roommate, where STUDENT is linked with STUDENT. The Degree
of Unary Relationship is 1.
Binary Relationship/Association
●Binary Relationships exist between the Instances of two Entity Types.
●A Binary Relationship is the one that links two Entities Types e.g., STUDENT -
CLASS.
●The Degree of Binary Relationship is 2.
Ternary Relationship/Association
● Ternary Relationship exists among the Instances of three Entity Types.
● A Ternary Relationship is the one that involves three Entity Types.
●The Degree of Ternary Relationship is 3.
●The following Relationship means that one or many Analysts with one or many
Programmers work on one or more Projects.
Relationship Cardinalities:
The Cardinality of a Relationship is the number
of Entity Instances that can be associated with
another Entity Instances under that Relationship.
Types of Relationship
Types of Relationship
Types of Relationship
Types of Relationship
Types of Relationship
Types of Relationship
Cardinality Constraints:
The Cardinality Constraint specifies the number of instances of one entity Type that can be associated with each
instance of the other Entity Type.
There are three symbols to show Cardinality Constraint.
● A circle (O) means Zero,
● A line ( ) means one and crow’s foot symbol means many.
● A circle O indicates that relationship is Optional.
● A stroke indicates that relationship Mandatory.
● A crows-foot indicates that many relationships between instances.
Notation Styles: There are many notation styles that express cardinality.
● Information Engineering Style
● Chen Style
● Bachman Style
● Martin Style
Notation Styles:
Notation Styles:
Notation Styles:
Notation Styles:
Quiz 2
Draw an Conceptual Schema & ERD Diagram of a Hospital System Showing All Possible Attributes, Entities and
the Relationships that exist between them.
Attributes
●Attributes: A property or characteristic of an Entity Type is called an Attribute.
●Something that describes an Entity Type.
● For example, the employee Entity Type, the attributes would be the employee
number, name, job title, hire date, department number and so on. To represent
an attribute in a Model, use the following conventions: - Use Singular Name in
Lowercase - Symbol for Attribute
Attributes
●A property or characteristic of an Entity Type is called an Attribute.
●Something that describes an Entity Type.
● For example, the employee Entity Type, the attributes would be the employee
number, name, job title, hire date, department number and so on. To represent
an attribute in a Model, use the following conventions: - Use Singular Name in
Lowercase - Symbol for Attribute
Attributes
●Types of Attributes:
1. Required Attribute
2. Optional Attribute
3. Simple Attribute
4. Composite Attribute
5. Single/Atomic Valued Attribute
6. Multi Valued Attribute
7. Stored Attribute
8. Derived Attribute
Attributes
● Required Attribute: A Required Attribute is an Attribute that must have a data
value e.g., Student Registration Number, CNIC, Name etc. These Attributes are
required because they describe what is important in the entity.
● Optional Attribute: An Optional Attribute may or may not have a data value in it
and can be left blank e.g., Student Phone Number, Email Address, Passport
Number etc.
● Simple Attribute: An Attribute that cannot be decomposed into smaller Attributes
e.g., age, roll#, CNIC, Phone# etc. Symbol for Simple Attribute
Attributes
● Composite Attribute: An Attribute that can be decomposed into smaller Attributes e.g.
Name, address etc.
○ Name can be divided into first name, middle name, last name. Address can be
divided into House#, Street#, Sector#, Phase#, Tehsil, District etc. Symbol for
Composite Attribute.
● Single/Atomic Valued Attribute: An Attribute that has only one value for an Entity
e.g., Roll# CNIC, Passport#, name, father name etc.
● Multi Valued Attribute: An Attribute that can have more than one values for an Entity
e.g., Address, Email Address, Phone#, Subject, Hobbies, Skills etc. Symbol for Multi
valued Attribute
Attributes
● Stored Attribute: Normally Attributes are Stored Attributes, that is, their
values are stored and accessed as such from the database.
○ An Attribute whose value is stored in the database and cannot be derived from another
Attribute e.g., Date of Birth (D.O.B).
● Derived Attribute: Sometimes Attributes values are not stored as such,
rather they are computed or derived based on some other value which is
stored in database.
○ An Attribute whose value can be derived/calculated from the Stored Attribute e.g., age
which is derived from D.O.B, experience etc.
○ A Derived Attribute is based on another Attribute. Symbol for Derived Attribute
Attributes Example
ERD
● E-R Diagram is a graphical representation of E-R model using a set of standard symbols.
● ER Diagram is a type of flowchart that illustrates how “entities” such as people, objects or
concepts relate to each other within a system.
● ER Diagram shows the complete logical structure of a database.
● ER Diagrams are created based on three basic concepts: entities, attributes and relationships.
● Components/Elements in ERD: The major activity is identifying entities, attributes, and their
relationships to construct model using the Entity Relationship Diagram.
● The E-R Diagram supports the following major components/Elements:
● Entity Table
● Attribute Column
● Relationships Line
THE END

More Related Content

ODP
ER Model in DBMS
PPTX
Er diagram
PPTX
E_R-Diagram (2).pptx
PPTX
Database management system power point presentation
PDF
Lecture 2 database management system.pdf
PPTX
Data Models.pptx
PPTX
er-models.pptx
ER Model in DBMS
Er diagram
E_R-Diagram (2).pptx
Database management system power point presentation
Lecture 2 database management system.pdf
Data Models.pptx
er-models.pptx

Similar to Database Systems (3+1)_Entity Relationship Models (2).pptx (20)

PPTX
SQL.pptx
PPTX
Day 1 SQL.pptx
PPSX
Cn presentation on the topic called as re modelling
PPT
DBMS PPT
PPT
E-R Model Entity relationship model, Entity, Attributes.ppt
PPT
Entity relationship Model, Unit-1.2-1.ppt
PPTX
ER MODEL.pptx
PPT
ER-Model-ER Diagram
PDF
ER diagram
PPTX
Unit 1 Data Modeling_Updated (2) (2).pptx
PPTX
Presentation on Entity Relationship Diagram.pptx
PPTX
UNIT 1.2_CH7_ER DIAGRAM Database management system
PPTX
Jobs manager vs supervisor.pptx
PPTX
Entity Relationship Diagram - DBMS - PPT
PDF
3. Chapter Three.pdf
PDF
Chapter 3 Database Modeling short slide.pdf
PPTX
SBD 05.pptxffefefeefefeefefefefefefefefe
PPT
3144-unit-1entityrmodel-171122051336.ppt
PPT
ER Diagram introduction .ppt
PPTX
Entity-Relationship Data Model
SQL.pptx
Day 1 SQL.pptx
Cn presentation on the topic called as re modelling
DBMS PPT
E-R Model Entity relationship model, Entity, Attributes.ppt
Entity relationship Model, Unit-1.2-1.ppt
ER MODEL.pptx
ER-Model-ER Diagram
ER diagram
Unit 1 Data Modeling_Updated (2) (2).pptx
Presentation on Entity Relationship Diagram.pptx
UNIT 1.2_CH7_ER DIAGRAM Database management system
Jobs manager vs supervisor.pptx
Entity Relationship Diagram - DBMS - PPT
3. Chapter Three.pdf
Chapter 3 Database Modeling short slide.pdf
SBD 05.pptxffefefeefefeefefefefefefefefe
3144-unit-1entityrmodel-171122051336.ppt
ER Diagram introduction .ppt
Entity-Relationship Data Model
Ad

Recently uploaded (20)

PDF
Trump Administration's workforce development strategy
PDF
Computing-Curriculum for Schools in Ghana
PPTX
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PPTX
Unit 4 Skeletal System.ppt.pptxopresentatiom
PDF
What if we spent less time fighting change, and more time building what’s rig...
PDF
Classroom Observation Tools for Teachers
PPTX
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
PDF
Empowerment Technology for Senior High School Guide
PDF
A systematic review of self-coping strategies used by university students to ...
PDF
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
PPTX
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
PDF
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
PDF
Complications of Minimal Access Surgery at WLH
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PPTX
Introduction to Building Materials
PPTX
Digestion and Absorption of Carbohydrates, Proteina and Fats
Trump Administration's workforce development strategy
Computing-Curriculum for Schools in Ghana
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
Unit 4 Skeletal System.ppt.pptxopresentatiom
What if we spent less time fighting change, and more time building what’s rig...
Classroom Observation Tools for Teachers
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
Empowerment Technology for Senior High School Guide
A systematic review of self-coping strategies used by university students to ...
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
Complications of Minimal Access Surgery at WLH
Final Presentation General Medicine 03-08-2024.pptx
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
Introduction to Building Materials
Digestion and Absorption of Carbohydrates, Proteina and Fats
Ad

Database Systems (3+1)_Entity Relationship Models (2).pptx

  • 1. Database Systems (3+1) Entity Relationship Models Aakash Ahmad (Lecturer) Computer Science Dept. CECOS University of IT and Technology, Peshawar
  • 2. Contents and Objectives Contents ● ER Model/ERD ● Design Process ● Modeling ● Constraints ● E-R Diagram ● Design Issues ● Weak Entity Sets ● Extended E-R Features ● Design of the University Database ● Database Design UML Objectives To understand ER model ● Design ● ER Modeling Constraints To understand ER-Diagram ○ Entity ○ Attributes ○ Tuples ○ Associations
  • 3. Database Design Phases ● The initial phase of database design is to fully characterize the data according to the needs of database users. ●Next, the designer chooses a data model to translate the requirements into a conceptual schema of the database. ●The process of moving from a data model to the implementation of the database proceeds in two final design phases. ●Logical Design – Deciding on the database schema. Database design requires that we find a “good” collection of relation schemas. ●Physical Design – Deciding on the physical layout of the database.
  • 4. ER Model ● The ER data model was developed to facilitate database design ●An Entity Relationship Model (E-R Model) is a detailed, logical representation of the data for an organization or for business area. ●ER Model is used to show the Conceptual Schema of an Organisation. E-R Model is expressed in three terms: ○ Entities ○ Relationship (or association) ○ Attributes
  • 5. Entity ●Entity is the basic building block of the Entity Relation Data Model. ●The term Entity is used in three different meanings or for three different terms and that are: ■ Entity Type ■ Entity Instance ■ Entity Set
  • 6. Entity Type ●Entity Type: A collection or a set of entities (often corresponds to a table) that shares common properties. ●The Entity Type can be defined as a name/label assigned to items/objects which have similar properties. ● It could be a person, place, object or event about which the organization wishes to maintain data. ●Examples are: Departments, Employees, Students, and Orders etc. To represent an Entity Type in a Model, use the following conventions: ○ Soft box with rectangle dimensions. ○ Singular, Unique entity name. ○ Entity name in Uppercase.
  • 7. Entity Instance and Set ● : A single occurrence (existence) of an Entity Type is called Entity Instance. ● For example, following table lists the Entity Types and their defining Properties and Instances. ● Entity Set: A group of Entity Instances of a particular Entity Type is called an Entity Set. ● For example, all employees of an organization form an Entity Set. Like all students, all courses, all of them form Entity Set of different Entity Types.
  • 8. Entity Types: There are two types of Entity Types Strong/Regular Entity Type ● An Independent Entity. An Entity Type that exists independently of other Entity Types. ● The Strong Entity Type is also called the Identifying Owner. ● An Entity Type whose Instances can exist independently, that is, without being linked to the Instances of any other Entity Type is called Strong Entity Type. ● A major property of the Strong Entity Type is that they have their own identification. ● For example, employee in an organization, is an independent or Strong Entity Type, since its Instances can exist independently. Weak Entity Type/Dependent Entity. ● An Entity Type whose existence depends on another Entity Type. ● An Entity Type whose Instances cannot exist without being linked with Instances of some other Entity Type, i.e., they cannot exist independently. ● For example, in an organization, to maintain data about the Vehicles owned by the employees. Now a particular Vehicle can exist in this organization only if the owner already exists there as employee. Similarly, if an employee leaves the job and the organization decides to delete the record of the employee then the record of the Vehicle will also be deleted since it cannot exist without being linked to an Instance of employee.
  • 9. Entity Types: There are two types of Entity Types Strong/Regular Entity Type ● Strong entity always has a primary key. ● Strong entity is not dependent on any other entity. ● Strong entity is represented by a single rectangle. ● Relationship between two strong entities is represented by a single diamond. Weak Entity Type/Dependent Entity. ● While a weak entity has not a primary key. ● Weak entity depends on strong entity. ● Weak entity is represented by a double rectangle. ● While the relationship between one strong and one weak entity is represented by a double diamond.
  • 10. Relationship/Association ●Relationship represents an association between two or more entities. ●Relationships are the connections and interactions between the Entity Instances. ●Examples are employees and departments, orders and items etc. ○ Symbol of Relationship: Diamond ○ Symbol of Relationship (Weak Relation): Double Diamond
  • 11. Relationship/Association ●Types/Degree of Relationships/Association: ●A Relationship may consist of many Entity Types. ●The number of Entity Types in a Relationship is called Degree of Relationship. ●The Relationships of Degree 2 are most common and are also called Binary Relationships. ●The Types of Relationships with respect to Degree are as follows: ○ 1. Unary Relationship ○ 2. Binary Relationship ○ 3. Ternary Relationship
  • 12. ●Unary Relationship/Association ●Unary Relationship is a type of Relationship that is established between the Instances of same Entity Type. ●An Entity Type linked with itself, also called Unary/Recursive Relationship. ●Example: Roommate, where STUDENT is linked with STUDENT. The Degree of Unary Relationship is 1.
  • 13. Binary Relationship/Association ●Binary Relationships exist between the Instances of two Entity Types. ●A Binary Relationship is the one that links two Entities Types e.g., STUDENT - CLASS. ●The Degree of Binary Relationship is 2.
  • 14. Ternary Relationship/Association ● Ternary Relationship exists among the Instances of three Entity Types. ● A Ternary Relationship is the one that involves three Entity Types. ●The Degree of Ternary Relationship is 3. ●The following Relationship means that one or many Analysts with one or many Programmers work on one or more Projects.
  • 15. Relationship Cardinalities: The Cardinality of a Relationship is the number of Entity Instances that can be associated with another Entity Instances under that Relationship.
  • 22. Cardinality Constraints: The Cardinality Constraint specifies the number of instances of one entity Type that can be associated with each instance of the other Entity Type. There are three symbols to show Cardinality Constraint. ● A circle (O) means Zero, ● A line ( ) means one and crow’s foot symbol means many. ● A circle O indicates that relationship is Optional. ● A stroke indicates that relationship Mandatory. ● A crows-foot indicates that many relationships between instances. Notation Styles: There are many notation styles that express cardinality. ● Information Engineering Style ● Chen Style ● Bachman Style ● Martin Style
  • 27. Quiz 2 Draw an Conceptual Schema & ERD Diagram of a Hospital System Showing All Possible Attributes, Entities and the Relationships that exist between them.
  • 28. Attributes ●Attributes: A property or characteristic of an Entity Type is called an Attribute. ●Something that describes an Entity Type. ● For example, the employee Entity Type, the attributes would be the employee number, name, job title, hire date, department number and so on. To represent an attribute in a Model, use the following conventions: - Use Singular Name in Lowercase - Symbol for Attribute
  • 29. Attributes ●A property or characteristic of an Entity Type is called an Attribute. ●Something that describes an Entity Type. ● For example, the employee Entity Type, the attributes would be the employee number, name, job title, hire date, department number and so on. To represent an attribute in a Model, use the following conventions: - Use Singular Name in Lowercase - Symbol for Attribute
  • 30. Attributes ●Types of Attributes: 1. Required Attribute 2. Optional Attribute 3. Simple Attribute 4. Composite Attribute 5. Single/Atomic Valued Attribute 6. Multi Valued Attribute 7. Stored Attribute 8. Derived Attribute
  • 31. Attributes ● Required Attribute: A Required Attribute is an Attribute that must have a data value e.g., Student Registration Number, CNIC, Name etc. These Attributes are required because they describe what is important in the entity. ● Optional Attribute: An Optional Attribute may or may not have a data value in it and can be left blank e.g., Student Phone Number, Email Address, Passport Number etc. ● Simple Attribute: An Attribute that cannot be decomposed into smaller Attributes e.g., age, roll#, CNIC, Phone# etc. Symbol for Simple Attribute
  • 32. Attributes ● Composite Attribute: An Attribute that can be decomposed into smaller Attributes e.g. Name, address etc. ○ Name can be divided into first name, middle name, last name. Address can be divided into House#, Street#, Sector#, Phase#, Tehsil, District etc. Symbol for Composite Attribute. ● Single/Atomic Valued Attribute: An Attribute that has only one value for an Entity e.g., Roll# CNIC, Passport#, name, father name etc. ● Multi Valued Attribute: An Attribute that can have more than one values for an Entity e.g., Address, Email Address, Phone#, Subject, Hobbies, Skills etc. Symbol for Multi valued Attribute
  • 33. Attributes ● Stored Attribute: Normally Attributes are Stored Attributes, that is, their values are stored and accessed as such from the database. ○ An Attribute whose value is stored in the database and cannot be derived from another Attribute e.g., Date of Birth (D.O.B). ● Derived Attribute: Sometimes Attributes values are not stored as such, rather they are computed or derived based on some other value which is stored in database. ○ An Attribute whose value can be derived/calculated from the Stored Attribute e.g., age which is derived from D.O.B, experience etc. ○ A Derived Attribute is based on another Attribute. Symbol for Derived Attribute
  • 35. ERD ● E-R Diagram is a graphical representation of E-R model using a set of standard symbols. ● ER Diagram is a type of flowchart that illustrates how “entities” such as people, objects or concepts relate to each other within a system. ● ER Diagram shows the complete logical structure of a database. ● ER Diagrams are created based on three basic concepts: entities, attributes and relationships. ● Components/Elements in ERD: The major activity is identifying entities, attributes, and their relationships to construct model using the Entity Relationship Diagram. ● The E-R Diagram supports the following major components/Elements: ● Entity Table ● Attribute Column ● Relationships Line