SlideShare a Scribd company logo
1 of 81
Er. Nawaraj Bhandari
Topic 3
Entity Relationship Modelling 1
Entity Relationship(ER) Diagram
 We will learn to develop ER Diagram in this topic.
Entity
 An entity can be defined as anything, which can be uniquely identified
and about which data is stored in a database.
 A place, person, picture, concept (e.g. course, position, job) are the
example of an entity.
 Some other examples can be student, workers, car, departments, etc.
Entity Type
 An entity type is a collection of similar entities.
 An entity-type is a category.
 An entity type is a group of objects, people, concepts or other items
that have the same set of properties or attributes.
Entity Relationship(ER) Modelling
 In 1976, Peter Chen first proposed modeling databases using a
graphical technique that humans can relate easily.
 An Entity–Relationship (ER) model is an abstract or conceptual way of
describing a database
 An ER Model is based on a perception of a real world that consists of
collection of basic objects called entities and relationships among
these objects.
 3 Notations Type: UML, CHROWS FEET,CHEN
Entity Relationship Modelling 1 Topic 3 - 3.6
© NCC Education LimitedV1.0
Notations 1 – UML
(Unified modeling
language)
Student
Student
on
Module
Module
Attributes:
Module Code(PK)
Module Name
Attributes:
Student No(PK)
Student Name
Attributes:
Module Code (FK)
Student No (FK)
0...*
1
1
0...*
Entity Relationship Modelling 1 Topic 3 - 3.7
© NCC Education LimitedV1.0
Notations 2 -
CROWS FEET
Module
Student on
Module
Student
Attributes:
Module Code(PK)
Module Name
Attributes:
Student No(PK)
Student Name
Attributes:
Module Code(PK)(FK)
Student No (PK) (FK)
Entity Relationship Modelling 1 Topic 3 - 3.8
© NCC Education LimitedV1.0
Notations 3 -
CHEN
Student
Module Module Code
Student No
M
M
Takes
Database Schema
 The overall design or structure of the database is called the database
schema.
 Three types:
1. Internal Schema
2. Conceptual Schema
3. External Schema
Types of Schema
1. Internal Schema
describes the physical storage structure of database.
2. Conceptual Schema
hides the details of physical storage structures and concentrates
on describing entities, data types, relationships, operations and
constraints
3. External Schema
describes a subset of the database according to the format the
user wants and hides the rest.
Data Independence
 The ability to modify schema definition in one level without affecting
schema definition in the next higher level is called data
independence.
 There are two levels of data independence.
1. Physical data independence
2. Logical data independence.
Physical Data Independence
 Physical data independence means the capacity to change the
internal schema or physical storage without affecting conceptual or
external schema.
 Internal schema may be changed to improve the performance.
Logical Data Independence
 Logical data independence is the ability to modify the logical or
conceptual schema without affecting to external schema or
application program.
 Logical Data independence means if we add some new columns or
remove some columns from table then the user view and programs
should not change.
Entity Relationship(ER) Modelling
 The ER model achieves a high degree of data independence which
means that the database designer do not have to worry about the
physical structure of the database.
 The goal of ER Modelling is to produce a model of data that is non-
technical and free of ambiguities
Entity Relationship(ER) Diagram
 ER diagram is a graphical modelling to standardize ER modelling.
 The modeling can be carried out with the help of pictorial
representation of entities, attributes, and relationships.
Attributes
 An attribute is a property of an entity type.
 The data that we want to keep about each entity within an entity type is
contained in attributes.
 Examples of Attributes :
1. Roll number, name and grade are the attributes of Student.
2. Brand, cost and weight are the attributes of Cellphone.
3. Book name, price, author, publisher, etc. are attributes of Book.
Types of Attributes
1. Single-valued attribute
2. Multi-valued attribute
3. Null Attribute
4. Simple Attribute
5. Composite Attribute
6. Key Attribute
7. Derived Attribute
8. Attribute Domain
Types of Attributes
1. Single-valued attribute :
Attribute that holds a single value for an occurrence of an entity type.
E.g. age, first_name, last_name, full_name, Gender etc.
2. Multi-valued attribute :
Attribute where there might be more than one value for a given
occurrence of an entity type, e.g. for the 'Telephone Number', where a
person or company might have many of these.
3. Null attribute :
Attribute that has NULL.
Types of Attributes
4. Simple Attribute
It is composed of a single component. e.g. age, first_name,
last_name, Gender etc. But full_name is not simple attribute.
Because it is composed of first_name and last_name.
5. Composite Attribute
It is composed of more than one component. For example,
'address' might have city, state, country, zip code, etc.
Types of Attributes
6. Key Attribute
Primary Key is a key attribute.
Not Null and Unique attribute of an entity
At most one attribute in each entity
7. Derived Attribute
The value of the derived attribute can be derived from the values
of other attributes
Age of a person can be derived from the date of birth and current
date i.e. age = current date – date of birth.
Types of Attributes
8. Attribute Domain
A domain is the set of allowable values for an attribute or number
of attributes.
A domain therefore limits the values that an attribute can have.
For example, the domain of 'gender' would include the values
'Male' ,'Female’, ’Other’.
Similarly, the domain of fruit would include the values 'Apple',
'Orange' etc.
Relationship
 A relationship is an association of entities showing how the entities
are related with each other.
The examples of relationship are:
 Teaching is the relationship between Lecturer and Student.
 Buying is the relationship between Vendor and Customer.
 Treatment is the relationship between Doctor and Patient.
Types of Relationship or Multiplicity
 Number or range of possible occurrences of an entity type in relation
to another entity type (CARDINALITY)
1. One-to-One (1 : 1)
2. One-to-Many (1 : N)
3. Many-to-One (N : 1)
4. Many-to-Many (M : N)
Types of Relationship or Multiplicity
1. One-to -One (1 : 1)
Each department can have only one
department head.
Each worker works in one department.
2. One-to-Many (1 : N)
One course can have many students registered.
A lecturer may be teaching to many students.
Types of Relationship or Multiplicity
3. Many-to-One (N : 1)
Many cities come under one country.
Many books can be written by one writer.
Many authors can write one book.
4. Many-to-Many (M : N)
An Author can write several Books, and a Book
can be written by several Authors
A teacher teaches many class and a
class studies from many teachers.
ER Diagram Notation (CHEN)
Represents an entity set, But in CROWS FEET entity
set are represents by rounded rectangle.
Represents an attribute
Represent linking of attributes to entity sets and of
entity sets to relationship sets.
Represents a relationship
ER Diagram
ER Diagram
 Draw an ER Diagram for ClassRoom which has two attributes :
room_no and building_name.
ER Diagram(Chen)
N 1
ER Diagram(CROWS FEET )
ER Diagram (Chen)
N
1
N
M
ER Diagram(CROWS FEET )
Linking Table(Entity) or
Associative or Composite
entity
Attribute Notation (CHEN)
Single Valued Attribute
Multi-valued Attribute
Key Attribute
Derived Attribute
Composite Attribute
 An employee has first name, last name and can have more than one
qualifications.
Multi-valued Attribute
Key Attribute
 Primary Key
 A department has Primary Key dept_no, department_name and
location
 foreign key is expressed by dotted underline.
Derived Attribute
 The value of the derived attribute can be derived from the values of
other related attributes.
 Age of a person can be derived from the date of birth and current
date i.e. age = current date – date of birth. In this example, age is the
derived attribute.
Composite Attribute
 Composite attribute is one which can be further subdivided into
simple attributes.
Strong entity
Strong entity is one whose
existence does not depend on
other entity.
Weak entity
Weak entity is an entity that
depends on another entity. Weak
entity doesn't have key attribute
of their own.
Associative or
composite entity
Associative entity is used to
create many-to-many
relationship between different
entities
Classification of Entity Sets (CHEN)
 Entity sets can be broadly classified into:
Classification of Entity Sets (CHEN)
 Consider the example, student takes course. Here student is a strong
entity.
 Course is considered as weak entity because, if there are no students
to take a particular course, then that course cannot be offered. The
Course entity depends on the student entity.
Associative or Composite entity
 The database relational model does not offer direct support to many-
to-many relationships. So, we require associative or composite entity.
 Consider the example, customer purchases book.
 A customer can purchase many books. And a book can be purchased
by many customers. So, here purchases is an associative entity. The
entity purchases is mediator for customer and book.
Task : ER Diagram
1. Draw an ER diagram for student.
2. Draw an ER diagram for customers and loan relation.
3. Draw an ER diagram for hospital with a set of patients and medical
doctors.
4. Draw an ER diagram for banking system.
5. Draw an ER diagram for car insurance company.
Relationship Degree
 Relationship degree refers to the number of associated entities in a
relationship.
 The relationship degree can be broadly classified into
1. Unary(Recursive) relationship
2. Binary relationship
3. Ternary relationship
Unary(Recursive) relationship
 The number of associated entity is one.
 An entity related to itself is known as recursive relationship.
Binary relationship
 In a binary relationship, two entities are involved.
 Consider the example: each department will have many workers.
Ternary relationship
 In a ternary relationship, three entities are simultaneously involved.
 Example : Consider a project is assigned to many employee. And the
project is assigned to one location.
ER Diagram Notation (CROW'S FEET)
Entity Name
attribute namePK
attribute name
attribute name
Entity Name
Entity Relationship
Illustrates an association between two
entities. It has a name which is a verb. It
also has cardinality.
is assigned to
ER Diagram Notation (CROW'S FEET)
zero or more
one or more
one and only one
zero or 1
Cardinality
Cardinality refers to the maximum number of times an instance in one
entity can be associated with instances in the related entity. It can be
zero or one or more.
Some examples (CROW'S FEET)
courseteacher
teaches
coursestudent
takes
ER Diagram Notation (UML)
 A Book is written by one or more authors. An author writes one or
more Books. A Category may have zero or many books.
 Nouns: Book, Author, Category
 [Note : Many to Many Relationship cannot be shown in relational
model]
1..N
AuthorBook AuthorBook
11..N1
Category
1
0..N
ER Diagram Notation (CROW'S FEET)
A Gardening Company
 The company hires out workers as they need to.
 Workers in the town stay in lodgings. A lodging may have many
workers in it. We are only concerned with the workers’ current
lodging. Workers possess certain skills such as ‘Tree Surgery’ and
‘Garden Design’. They may have more than one skill.
 [Note : Try to identify nouns that could possibly be entities.]
A Gardening Company - Nouns
 The company hires out workers as they need to.
 Workers in the town stay in lodgings. A lodging may have many
workers in it. We are only concerned with the workers’ current
lodging. Workers possess certain skills such as ‘Tree Surgery’ and
‘Garden Design’. They may have more than one skill.
 [Note : We are only concerned with one town. So, town is not entity
here. But 'Town' is an attribute of the Lodging.]
Possible Solution(UML)
0..*
SkillWorker SkillWorker
10..*1
Lodging
0..*
1
Possible Solution(CROW'S FEET)
Equipment & Students
 A college department of photography allocates equipment to its
students.
 A student might be allocated up to 3 types of equipment at a time.
 Equipment types can be allocated to many students.
Sports club
 A junior sports club keeps track of what sports its members do.
 Each member might be involved in more than one sport.
 Any sport will have many members involved
Possible Solution(CROW'S FEET)
Many-to-Many Relationship
 Module having many Students and Students taking many Modules
Taken ByModule Student
0..N 0..N
Attributes
ModuleID(PK)
ModuleName
Attributes
StudentID(PK)
StudentName
Many-to-Many Relationship
Module Student
0..N 0..N
ModuleStudent
1 1
Attributes
ModuleID(PK)
ModuleName
Attributes
StudentID(PK)
StudentName
Attributes
ModuleID(FK)
StudentID(FK)
Draw the ER : Car Hire Company
 Company has a number of models of car available for hire.
 Customers hire cars and this is recorded against a particular car
rather than a model, as the company might have several cars of the
same model.
 When a customer wants to reserve a particular model they can do so.
This is recorded against a model rather than the car.
 When a car of that model becomes available, it will be held for the
customer.
 When they come in for it, a record is made on the reservation to say
which car satisfied the reservation.
Draw the ER : Car Hire Company
 Company has a number of models of car available for hire.
 Customers hire cars and this is recorded against a particular car
rather than a model, as the company might have several cars of the
same model.
 When a customer wants to reserve a particular model they can do so.
This is recorded against a model rather than the car.
 When a car of that model becomes available, it will be held for the
customer.
 When they come in for it, a record is made on the reservation to say
which car satisfied the reservation.
Car Hire Company
Model
HireCar
Reservation
Customer
0..N
1
0..N 11 0..N
0..N 1
1
0..N
1 0..N
 Each supplier has a unique name.
 More than one supplier can be located in the same city.
 Each part has a unique part number.
 Each part has a color.
 A supplier can supply more than one part.
 A part can be supplied by more than one supplier.
 A supplier can supply a fixed quantity of each part.
Manufacturing Industry
Manufacturing Industry(Chen)
Manufacturing Industry(UML)
Manufacturing Industry (CROWS FEET)
Primary Key
 The PRIMARY KEY constraint uniquely identifies each record in a
database table.
 Primary keys must contain unique values.
 A primary key column cannot contain NULL values.
 Each table should have a primary key, and
each table can have only ONE primary key.
departments
------------------------
dept_no (PK)
department_name
location
Foreign Key
 A FOREIGN KEY in one table points to a PRIMARY KEY in another table
 A FOREIGN KEY is a column or a combination of columns that is used
to establish and enforce a link between two tables or entities.
departments
------------------------
dept_no (PK)
department_name
location
workers
------------------
emp_no (PK)
first_name
last_name
age
job_title
dept_no (FK)
Creating Foreign Key
Problems(pit·fall) with ER Models
 There are several problems that may arise when designing a ER
model. These are known as connection traps.
 There are two main types of connection traps:
1. Fan traps
2. Chasm traps
Fan Traps
 Fan traps occur in a situation when a model represents relationship
between entity types however a path between certain entity
occurrences is ambiguous.
 Example: (Staff)-1:N-works in-1-(Campus)-1-has-1:N-(Department).
 In this model, it may be impossible to determine the department a
staff belongs to.
DepartmentStaff Campus
1 1 1..*1..*
Entity Relationship Modelling 2 Topic 4 - 4.72
© NCC Education LimitedV1.0
Fan Traps
- 1
Campus ID Campus Name
C1 London
C2 Lagos
C3 Cairo
Staff ID Name Campus ID (FK)
S1 Eric
Hudson
C2
S2 Sandra
Smith
C1
S3 Malia
Shah
C1
Department ID Name Campus ID (FK)
D1 Humanities C1
D2 Computing C2
D3 Maths C2
Campus
Staff Department
In which Department does Eric work?
Fan Traps – The Solution
 Restructuring the model resolves trap (Campus)-1-has-1:N-
(Department)-1-has-1:N-(Staff)
CampusStaff Department
1 1..* 11..*
Entity Relationship Modelling 2 Topic 4 - 4.74
© NCC Education LimitedV1.0
Fan Traps
- 2
Campus
ID
Campus Name
C1 London
C2 Lagos
C3 Cairo
Staff ID Name Department ID (FK)
S1 Eric
Hudson
D3
S2 Sandra
Smith
D1
S3 Malia
Shah
D1
Department ID Name Campus ID (FK)
D1 Humanities C1
D2 Computing C2
D3 Maths C2
Campus
Staff
Department
We now know in which department Eric works
Chasm Traps
 Chasm Traps occur where there are relationships between entities, but
one of the relationships is non-mandatory.
 A model suggests the existence of a relationship between entity types,
but the pathway does not exist between certain entity occurrences.
This connection traps is known as Chasm Traps.
 http://db.grussell.org/section005.html
Chasm Traps – The Problem
 A branch has many staff members who manage properties, but not all
properties are managed by a member of staff, and not all staff
manage properties.
Staff PropertyBranch
1...* 0...*0...11
Entity Relationship Modelling 2 Topic 4 - 4.77
© NCC Education LimitedV1.0
Chasm Trap - 1
Branch
ID
Branch
Name
1 Ilford
2 Redbridge
Staff ID Name Branch ID
(FK)
S1 Davinda 1
S2 Roberta 1
S3 Eddie 2
Property ID Property
Name
Staff ID
(FK)
P1 Yap
Mansions
S1
P2 Hill House
P2 Usher
House
S2
Branch
Staff
Property
Which Branch manages
‘Hill House’?
Chasm Traps – The Solution
 The solution is to change the structure and represent both
relationships.
Property
Staff
Branch
1...* 0...*0...11
1 0...*
Chasm Traps – The Solution
Branch ID Branch Name
1 Ilford
2 Redbridge
Staff ID Name Branch ID (FK)
S1 Davinda 1
S2 Roberta 1
S3 Eddie 2
Property ID Property Name Staff ID (FK) Branch ID (FK)
P1 Yap Mansions S1 1
P2 Hill House 2
P3 Usher House S2 1
Branch Staff
Property
We now
know which
Branch
manages
‘Hill House’
References
 http://www.studytonight.com/dbms/er-diagram.php
 http://www.blackwasp.co.uk/SQLDerivedTables.aspx
 http://www2.cs.uregina.ca/~bernatja/crowsfoot.html
 http://revj.sourceforge.net/traps.html
 http://db.grussell.org/section005.html
 http://www.tutorialspoint.com/dbms/dbms_data_independence.htm
 http://en.wikipedia.org/wiki/Three_schema_approach
 http://en.wikipedia.org/wiki/Data_independence
 http://www.tutorialspoint.com/dbms/er_model_basic_concepts.htm
END OF TOPIC 3
Any Questions

More Related Content

What's hot (20)

Entity relationship diagram (erd)
Entity relationship diagram (erd)Entity relationship diagram (erd)
Entity relationship diagram (erd)
 
Data Dictionary
Data DictionaryData Dictionary
Data Dictionary
 
Files Vs DataBase
Files Vs DataBaseFiles Vs DataBase
Files Vs DataBase
 
EER modeling
EER modelingEER modeling
EER modeling
 
Database systems - Chapter 2
Database systems - Chapter 2Database systems - Chapter 2
Database systems - Chapter 2
 
Entity relationship modelling
Entity relationship modellingEntity relationship modelling
Entity relationship modelling
 
Relational model
Relational modelRelational model
Relational model
 
Introduction of Database Design and Development
Introduction of Database Design and DevelopmentIntroduction of Database Design and Development
Introduction of Database Design and Development
 
E-R diagram in Database
E-R diagram in DatabaseE-R diagram in Database
E-R diagram in Database
 
Type of database models
Type of database modelsType of database models
Type of database models
 
Data modeling using the entity relationship model
Data modeling using the entity relationship modelData modeling using the entity relationship model
Data modeling using the entity relationship model
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model Introduction
 
All data models in dbms
All data models in dbmsAll data models in dbms
All data models in dbms
 
DBMS PPT
DBMS PPTDBMS PPT
DBMS PPT
 
Data independence
Data independenceData independence
Data independence
 
Set operators
Set  operatorsSet  operators
Set operators
 
Data models
Data modelsData models
Data models
 
Er model ppt
Er model pptEr model ppt
Er model ppt
 
Enhanced ER(database)
Enhanced ER(database)Enhanced ER(database)
Enhanced ER(database)
 

Similar to Entity Relationship Modelling

E_R-Diagram (2).pptx
E_R-Diagram (2).pptxE_R-Diagram (2).pptx
E_R-Diagram (2).pptxsandeep54552
 
Entity Relationship Diagram – ER Diagram in DBMS.pptx
Entity Relationship Diagram – ER Diagram in DBMS.pptxEntity Relationship Diagram – ER Diagram in DBMS.pptx
Entity Relationship Diagram – ER Diagram in DBMS.pptxsukrithlal008
 
5e7ry754.pptx
5e7ry754.pptx5e7ry754.pptx
5e7ry754.pptxqwert001
 
DBMS Unit-2_Final.pptx
DBMS Unit-2_Final.pptxDBMS Unit-2_Final.pptx
DBMS Unit-2_Final.pptxparimala123
 
Data Modeling Er
Data Modeling ErData Modeling Er
Data Modeling Er1ajnabi4u
 
Fundamentals of database system - Data Modeling Using the Entity-Relationshi...
Fundamentals of database system  - Data Modeling Using the Entity-Relationshi...Fundamentals of database system  - Data Modeling Using the Entity-Relationshi...
Fundamentals of database system - Data Modeling Using the Entity-Relationshi...Mustafa Kamel Mohammadi
 
Use analyzed requirements in the design of database.pptx
Use analyzed requirements in the design of database.pptxUse analyzed requirements in the design of database.pptx
Use analyzed requirements in the design of database.pptxMwangaPrayGod
 
Advantages and disadvantages of er model in DBMS. Types of database models ..
Advantages and disadvantages of er model in DBMS. Types of database models ..Advantages and disadvantages of er model in DBMS. Types of database models ..
Advantages and disadvantages of er model in DBMS. Types of database models ..Nimrakhan89
 
3. Chapter Three.pdf
3. Chapter Three.pdf3. Chapter Three.pdf
3. Chapter Three.pdffikadumola
 
Unit-1-DBMS-SUN-4 everything you need to know.pptx
Unit-1-DBMS-SUN-4 everything you need to know.pptxUnit-1-DBMS-SUN-4 everything you need to know.pptx
Unit-1-DBMS-SUN-4 everything you need to know.pptxnirajsharmapuneiat
 
ECEG 4702-Class7-Entity-Relationship modeling.pptx
ECEG 4702-Class7-Entity-Relationship modeling.pptxECEG 4702-Class7-Entity-Relationship modeling.pptx
ECEG 4702-Class7-Entity-Relationship modeling.pptxmiftah88
 
Introduction to database-ER Model
Introduction to database-ER ModelIntroduction to database-ER Model
Introduction to database-ER ModelAjit Nayak
 

Similar to Entity Relationship Modelling (20)

Er Modeling
Er ModelingEr Modeling
Er Modeling
 
dbms mannual.pdf
dbms mannual.pdfdbms mannual.pdf
dbms mannual.pdf
 
database
databasedatabase
database
 
ER Diagram_Kameshwari.docx
ER Diagram_Kameshwari.docxER Diagram_Kameshwari.docx
ER Diagram_Kameshwari.docx
 
E_R-Diagram (2).pptx
E_R-Diagram (2).pptxE_R-Diagram (2).pptx
E_R-Diagram (2).pptx
 
Entity Relationship Diagram – ER Diagram in DBMS.pptx
Entity Relationship Diagram – ER Diagram in DBMS.pptxEntity Relationship Diagram – ER Diagram in DBMS.pptx
Entity Relationship Diagram – ER Diagram in DBMS.pptx
 
Lecture one db
Lecture one dbLecture one db
Lecture one db
 
5e7ry754.pptx
5e7ry754.pptx5e7ry754.pptx
5e7ry754.pptx
 
DBMS Unit-2_Final.pptx
DBMS Unit-2_Final.pptxDBMS Unit-2_Final.pptx
DBMS Unit-2_Final.pptx
 
Data Modeling Er
Data Modeling ErData Modeling Er
Data Modeling Er
 
database.pptx
database.pptxdatabase.pptx
database.pptx
 
Fundamentals of database system - Data Modeling Using the Entity-Relationshi...
Fundamentals of database system  - Data Modeling Using the Entity-Relationshi...Fundamentals of database system  - Data Modeling Using the Entity-Relationshi...
Fundamentals of database system - Data Modeling Using the Entity-Relationshi...
 
Er model
Er modelEr model
Er model
 
Use analyzed requirements in the design of database.pptx
Use analyzed requirements in the design of database.pptxUse analyzed requirements in the design of database.pptx
Use analyzed requirements in the design of database.pptx
 
Advantages and disadvantages of er model in DBMS. Types of database models ..
Advantages and disadvantages of er model in DBMS. Types of database models ..Advantages and disadvantages of er model in DBMS. Types of database models ..
Advantages and disadvantages of er model in DBMS. Types of database models ..
 
Er model
Er modelEr model
Er model
 
3. Chapter Three.pdf
3. Chapter Three.pdf3. Chapter Three.pdf
3. Chapter Three.pdf
 
Unit-1-DBMS-SUN-4 everything you need to know.pptx
Unit-1-DBMS-SUN-4 everything you need to know.pptxUnit-1-DBMS-SUN-4 everything you need to know.pptx
Unit-1-DBMS-SUN-4 everything you need to know.pptx
 
ECEG 4702-Class7-Entity-Relationship modeling.pptx
ECEG 4702-Class7-Entity-Relationship modeling.pptxECEG 4702-Class7-Entity-Relationship modeling.pptx
ECEG 4702-Class7-Entity-Relationship modeling.pptx
 
Introduction to database-ER Model
Introduction to database-ER ModelIntroduction to database-ER Model
Introduction to database-ER Model
 

More from Bhandari Nawaraj (8)

Implementation
ImplementationImplementation
Implementation
 
Supporting Transactions
Supporting TransactionsSupporting Transactions
Supporting Transactions
 
Database Design
Database DesignDatabase Design
Database Design
 
SQL
SQL SQL
SQL
 
SQL
SQL SQL
SQL
 
The Relational Model
The Relational ModelThe Relational Model
The Relational Model
 
Database
DatabaseDatabase
Database
 
Dbms
DbmsDbms
Dbms
 

Recently uploaded

Scouring of cotton and wool fabric with effective scouring method
Scouring of cotton and wool fabric with effective scouring methodScouring of cotton and wool fabric with effective scouring method
Scouring of cotton and wool fabric with effective scouring methodvimal412355
 
Independent Solar-Powered Electric Vehicle Charging Station
Independent Solar-Powered Electric Vehicle Charging StationIndependent Solar-Powered Electric Vehicle Charging Station
Independent Solar-Powered Electric Vehicle Charging Stationsiddharthteach18
 
Study of Computer Hardware System using Block Diagram
Study of Computer Hardware System using Block DiagramStudy of Computer Hardware System using Block Diagram
Study of Computer Hardware System using Block DiagramChandrakantDivate1
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Ramkumar k
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxSCMS School of Architecture
 
Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...
Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...
Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...Christo Ananth
 
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdflitvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdfAlexander Litvinenko
 
Adsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) pptAdsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) pptjigup7320
 
UNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxUNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxkalpana413121
 
What is Coordinate Measuring Machine? CMM Types, Features, Functions
What is Coordinate Measuring Machine? CMM Types, Features, FunctionsWhat is Coordinate Measuring Machine? CMM Types, Features, Functions
What is Coordinate Measuring Machine? CMM Types, Features, FunctionsVIEW
 
Fundamentals of Structure in C Programming
Fundamentals of Structure in C ProgrammingFundamentals of Structure in C Programming
Fundamentals of Structure in C ProgrammingChandrakantDivate1
 
engineering chemistry power point presentation
engineering chemistry  power point presentationengineering chemistry  power point presentation
engineering chemistry power point presentationsj9399037128
 
Computer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesComputer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesChandrakantDivate1
 
Circuit Breakers for Engineering Students
Circuit Breakers for Engineering StudentsCircuit Breakers for Engineering Students
Circuit Breakers for Engineering Studentskannan348865
 
handbook on reinforce concrete and detailing
handbook on reinforce concrete and detailinghandbook on reinforce concrete and detailing
handbook on reinforce concrete and detailingAshishSingh1301
 
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...ssuserdfc773
 
Augmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptxAugmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptxMustafa Ahmed
 
analog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptxanalog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptxKarpagam Institute of Teechnology
 
Databricks Generative AI Fundamentals .pdf
Databricks Generative AI Fundamentals  .pdfDatabricks Generative AI Fundamentals  .pdf
Databricks Generative AI Fundamentals .pdfVinayVadlagattu
 
Introduction-to- Metrology and Quality.pptx
Introduction-to- Metrology and Quality.pptxIntroduction-to- Metrology and Quality.pptx
Introduction-to- Metrology and Quality.pptxProfASKolap
 

Recently uploaded (20)

Scouring of cotton and wool fabric with effective scouring method
Scouring of cotton and wool fabric with effective scouring methodScouring of cotton and wool fabric with effective scouring method
Scouring of cotton and wool fabric with effective scouring method
 
Independent Solar-Powered Electric Vehicle Charging Station
Independent Solar-Powered Electric Vehicle Charging StationIndependent Solar-Powered Electric Vehicle Charging Station
Independent Solar-Powered Electric Vehicle Charging Station
 
Study of Computer Hardware System using Block Diagram
Study of Computer Hardware System using Block DiagramStudy of Computer Hardware System using Block Diagram
Study of Computer Hardware System using Block Diagram
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...
Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...
Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...
 
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdflitvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
 
Adsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) pptAdsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) ppt
 
UNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxUNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptx
 
What is Coordinate Measuring Machine? CMM Types, Features, Functions
What is Coordinate Measuring Machine? CMM Types, Features, FunctionsWhat is Coordinate Measuring Machine? CMM Types, Features, Functions
What is Coordinate Measuring Machine? CMM Types, Features, Functions
 
Fundamentals of Structure in C Programming
Fundamentals of Structure in C ProgrammingFundamentals of Structure in C Programming
Fundamentals of Structure in C Programming
 
engineering chemistry power point presentation
engineering chemistry  power point presentationengineering chemistry  power point presentation
engineering chemistry power point presentation
 
Computer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesComputer Graphics Introduction To Curves
Computer Graphics Introduction To Curves
 
Circuit Breakers for Engineering Students
Circuit Breakers for Engineering StudentsCircuit Breakers for Engineering Students
Circuit Breakers for Engineering Students
 
handbook on reinforce concrete and detailing
handbook on reinforce concrete and detailinghandbook on reinforce concrete and detailing
handbook on reinforce concrete and detailing
 
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
 
Augmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptxAugmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptx
 
analog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptxanalog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptx
 
Databricks Generative AI Fundamentals .pdf
Databricks Generative AI Fundamentals  .pdfDatabricks Generative AI Fundamentals  .pdf
Databricks Generative AI Fundamentals .pdf
 
Introduction-to- Metrology and Quality.pptx
Introduction-to- Metrology and Quality.pptxIntroduction-to- Metrology and Quality.pptx
Introduction-to- Metrology and Quality.pptx
 

Entity Relationship Modelling

  • 1. Er. Nawaraj Bhandari Topic 3 Entity Relationship Modelling 1
  • 2. Entity Relationship(ER) Diagram  We will learn to develop ER Diagram in this topic.
  • 3. Entity  An entity can be defined as anything, which can be uniquely identified and about which data is stored in a database.  A place, person, picture, concept (e.g. course, position, job) are the example of an entity.  Some other examples can be student, workers, car, departments, etc.
  • 4. Entity Type  An entity type is a collection of similar entities.  An entity-type is a category.  An entity type is a group of objects, people, concepts or other items that have the same set of properties or attributes.
  • 5. Entity Relationship(ER) Modelling  In 1976, Peter Chen first proposed modeling databases using a graphical technique that humans can relate easily.  An Entity–Relationship (ER) model is an abstract or conceptual way of describing a database  An ER Model is based on a perception of a real world that consists of collection of basic objects called entities and relationships among these objects.  3 Notations Type: UML, CHROWS FEET,CHEN
  • 6. Entity Relationship Modelling 1 Topic 3 - 3.6 © NCC Education LimitedV1.0 Notations 1 – UML (Unified modeling language) Student Student on Module Module Attributes: Module Code(PK) Module Name Attributes: Student No(PK) Student Name Attributes: Module Code (FK) Student No (FK) 0...* 1 1 0...*
  • 7. Entity Relationship Modelling 1 Topic 3 - 3.7 © NCC Education LimitedV1.0 Notations 2 - CROWS FEET Module Student on Module Student Attributes: Module Code(PK) Module Name Attributes: Student No(PK) Student Name Attributes: Module Code(PK)(FK) Student No (PK) (FK)
  • 8. Entity Relationship Modelling 1 Topic 3 - 3.8 © NCC Education LimitedV1.0 Notations 3 - CHEN Student Module Module Code Student No M M Takes
  • 9. Database Schema  The overall design or structure of the database is called the database schema.  Three types: 1. Internal Schema 2. Conceptual Schema 3. External Schema
  • 10. Types of Schema 1. Internal Schema describes the physical storage structure of database. 2. Conceptual Schema hides the details of physical storage structures and concentrates on describing entities, data types, relationships, operations and constraints 3. External Schema describes a subset of the database according to the format the user wants and hides the rest.
  • 11. Data Independence  The ability to modify schema definition in one level without affecting schema definition in the next higher level is called data independence.  There are two levels of data independence. 1. Physical data independence 2. Logical data independence.
  • 12. Physical Data Independence  Physical data independence means the capacity to change the internal schema or physical storage without affecting conceptual or external schema.  Internal schema may be changed to improve the performance.
  • 13. Logical Data Independence  Logical data independence is the ability to modify the logical or conceptual schema without affecting to external schema or application program.  Logical Data independence means if we add some new columns or remove some columns from table then the user view and programs should not change.
  • 14. Entity Relationship(ER) Modelling  The ER model achieves a high degree of data independence which means that the database designer do not have to worry about the physical structure of the database.  The goal of ER Modelling is to produce a model of data that is non- technical and free of ambiguities
  • 15. Entity Relationship(ER) Diagram  ER diagram is a graphical modelling to standardize ER modelling.  The modeling can be carried out with the help of pictorial representation of entities, attributes, and relationships.
  • 16. Attributes  An attribute is a property of an entity type.  The data that we want to keep about each entity within an entity type is contained in attributes.  Examples of Attributes : 1. Roll number, name and grade are the attributes of Student. 2. Brand, cost and weight are the attributes of Cellphone. 3. Book name, price, author, publisher, etc. are attributes of Book.
  • 17. Types of Attributes 1. Single-valued attribute 2. Multi-valued attribute 3. Null Attribute 4. Simple Attribute 5. Composite Attribute 6. Key Attribute 7. Derived Attribute 8. Attribute Domain
  • 18. Types of Attributes 1. Single-valued attribute : Attribute that holds a single value for an occurrence of an entity type. E.g. age, first_name, last_name, full_name, Gender etc. 2. Multi-valued attribute : Attribute where there might be more than one value for a given occurrence of an entity type, e.g. for the 'Telephone Number', where a person or company might have many of these. 3. Null attribute : Attribute that has NULL.
  • 19. Types of Attributes 4. Simple Attribute It is composed of a single component. e.g. age, first_name, last_name, Gender etc. But full_name is not simple attribute. Because it is composed of first_name and last_name. 5. Composite Attribute It is composed of more than one component. For example, 'address' might have city, state, country, zip code, etc.
  • 20. Types of Attributes 6. Key Attribute Primary Key is a key attribute. Not Null and Unique attribute of an entity At most one attribute in each entity 7. Derived Attribute The value of the derived attribute can be derived from the values of other attributes Age of a person can be derived from the date of birth and current date i.e. age = current date – date of birth.
  • 21. Types of Attributes 8. Attribute Domain A domain is the set of allowable values for an attribute or number of attributes. A domain therefore limits the values that an attribute can have. For example, the domain of 'gender' would include the values 'Male' ,'Female’, ’Other’. Similarly, the domain of fruit would include the values 'Apple', 'Orange' etc.
  • 22. Relationship  A relationship is an association of entities showing how the entities are related with each other. The examples of relationship are:  Teaching is the relationship between Lecturer and Student.  Buying is the relationship between Vendor and Customer.  Treatment is the relationship between Doctor and Patient.
  • 23. Types of Relationship or Multiplicity  Number or range of possible occurrences of an entity type in relation to another entity type (CARDINALITY) 1. One-to-One (1 : 1) 2. One-to-Many (1 : N) 3. Many-to-One (N : 1) 4. Many-to-Many (M : N)
  • 24. Types of Relationship or Multiplicity 1. One-to -One (1 : 1) Each department can have only one department head. Each worker works in one department. 2. One-to-Many (1 : N) One course can have many students registered. A lecturer may be teaching to many students.
  • 25. Types of Relationship or Multiplicity 3. Many-to-One (N : 1) Many cities come under one country. Many books can be written by one writer. Many authors can write one book. 4. Many-to-Many (M : N) An Author can write several Books, and a Book can be written by several Authors A teacher teaches many class and a class studies from many teachers.
  • 26. ER Diagram Notation (CHEN) Represents an entity set, But in CROWS FEET entity set are represents by rounded rectangle. Represents an attribute Represent linking of attributes to entity sets and of entity sets to relationship sets. Represents a relationship
  • 28. ER Diagram  Draw an ER Diagram for ClassRoom which has two attributes : room_no and building_name.
  • 32. ER Diagram(CROWS FEET ) Linking Table(Entity) or Associative or Composite entity
  • 33. Attribute Notation (CHEN) Single Valued Attribute Multi-valued Attribute Key Attribute Derived Attribute Composite Attribute
  • 34.  An employee has first name, last name and can have more than one qualifications. Multi-valued Attribute
  • 35. Key Attribute  Primary Key  A department has Primary Key dept_no, department_name and location  foreign key is expressed by dotted underline.
  • 36. Derived Attribute  The value of the derived attribute can be derived from the values of other related attributes.  Age of a person can be derived from the date of birth and current date i.e. age = current date – date of birth. In this example, age is the derived attribute.
  • 37. Composite Attribute  Composite attribute is one which can be further subdivided into simple attributes.
  • 38. Strong entity Strong entity is one whose existence does not depend on other entity. Weak entity Weak entity is an entity that depends on another entity. Weak entity doesn't have key attribute of their own. Associative or composite entity Associative entity is used to create many-to-many relationship between different entities Classification of Entity Sets (CHEN)  Entity sets can be broadly classified into:
  • 39. Classification of Entity Sets (CHEN)  Consider the example, student takes course. Here student is a strong entity.  Course is considered as weak entity because, if there are no students to take a particular course, then that course cannot be offered. The Course entity depends on the student entity.
  • 40. Associative or Composite entity  The database relational model does not offer direct support to many- to-many relationships. So, we require associative or composite entity.  Consider the example, customer purchases book.  A customer can purchase many books. And a book can be purchased by many customers. So, here purchases is an associative entity. The entity purchases is mediator for customer and book.
  • 41. Task : ER Diagram 1. Draw an ER diagram for student. 2. Draw an ER diagram for customers and loan relation. 3. Draw an ER diagram for hospital with a set of patients and medical doctors. 4. Draw an ER diagram for banking system. 5. Draw an ER diagram for car insurance company.
  • 42. Relationship Degree  Relationship degree refers to the number of associated entities in a relationship.  The relationship degree can be broadly classified into 1. Unary(Recursive) relationship 2. Binary relationship 3. Ternary relationship
  • 43. Unary(Recursive) relationship  The number of associated entity is one.  An entity related to itself is known as recursive relationship.
  • 44. Binary relationship  In a binary relationship, two entities are involved.  Consider the example: each department will have many workers.
  • 45. Ternary relationship  In a ternary relationship, three entities are simultaneously involved.  Example : Consider a project is assigned to many employee. And the project is assigned to one location.
  • 46. ER Diagram Notation (CROW'S FEET) Entity Name attribute namePK attribute name attribute name Entity Name Entity Relationship Illustrates an association between two entities. It has a name which is a verb. It also has cardinality. is assigned to
  • 47. ER Diagram Notation (CROW'S FEET) zero or more one or more one and only one zero or 1 Cardinality Cardinality refers to the maximum number of times an instance in one entity can be associated with instances in the related entity. It can be zero or one or more.
  • 48. Some examples (CROW'S FEET) courseteacher teaches coursestudent takes
  • 49. ER Diagram Notation (UML)  A Book is written by one or more authors. An author writes one or more Books. A Category may have zero or many books.  Nouns: Book, Author, Category  [Note : Many to Many Relationship cannot be shown in relational model] 1..N AuthorBook AuthorBook 11..N1 Category 1 0..N
  • 50. ER Diagram Notation (CROW'S FEET)
  • 51. A Gardening Company  The company hires out workers as they need to.  Workers in the town stay in lodgings. A lodging may have many workers in it. We are only concerned with the workers’ current lodging. Workers possess certain skills such as ‘Tree Surgery’ and ‘Garden Design’. They may have more than one skill.  [Note : Try to identify nouns that could possibly be entities.]
  • 52. A Gardening Company - Nouns  The company hires out workers as they need to.  Workers in the town stay in lodgings. A lodging may have many workers in it. We are only concerned with the workers’ current lodging. Workers possess certain skills such as ‘Tree Surgery’ and ‘Garden Design’. They may have more than one skill.  [Note : We are only concerned with one town. So, town is not entity here. But 'Town' is an attribute of the Lodging.]
  • 55. Equipment & Students  A college department of photography allocates equipment to its students.  A student might be allocated up to 3 types of equipment at a time.  Equipment types can be allocated to many students.
  • 56. Sports club  A junior sports club keeps track of what sports its members do.  Each member might be involved in more than one sport.  Any sport will have many members involved
  • 58. Many-to-Many Relationship  Module having many Students and Students taking many Modules Taken ByModule Student 0..N 0..N Attributes ModuleID(PK) ModuleName Attributes StudentID(PK) StudentName
  • 59. Many-to-Many Relationship Module Student 0..N 0..N ModuleStudent 1 1 Attributes ModuleID(PK) ModuleName Attributes StudentID(PK) StudentName Attributes ModuleID(FK) StudentID(FK)
  • 60. Draw the ER : Car Hire Company  Company has a number of models of car available for hire.  Customers hire cars and this is recorded against a particular car rather than a model, as the company might have several cars of the same model.  When a customer wants to reserve a particular model they can do so. This is recorded against a model rather than the car.  When a car of that model becomes available, it will be held for the customer.  When they come in for it, a record is made on the reservation to say which car satisfied the reservation.
  • 61. Draw the ER : Car Hire Company  Company has a number of models of car available for hire.  Customers hire cars and this is recorded against a particular car rather than a model, as the company might have several cars of the same model.  When a customer wants to reserve a particular model they can do so. This is recorded against a model rather than the car.  When a car of that model becomes available, it will be held for the customer.  When they come in for it, a record is made on the reservation to say which car satisfied the reservation.
  • 63.  Each supplier has a unique name.  More than one supplier can be located in the same city.  Each part has a unique part number.  Each part has a color.  A supplier can supply more than one part.  A part can be supplied by more than one supplier.  A supplier can supply a fixed quantity of each part. Manufacturing Industry
  • 67. Primary Key  The PRIMARY KEY constraint uniquely identifies each record in a database table.  Primary keys must contain unique values.  A primary key column cannot contain NULL values.  Each table should have a primary key, and each table can have only ONE primary key. departments ------------------------ dept_no (PK) department_name location
  • 68. Foreign Key  A FOREIGN KEY in one table points to a PRIMARY KEY in another table  A FOREIGN KEY is a column or a combination of columns that is used to establish and enforce a link between two tables or entities. departments ------------------------ dept_no (PK) department_name location workers ------------------ emp_no (PK) first_name last_name age job_title dept_no (FK)
  • 70. Problems(pit·fall) with ER Models  There are several problems that may arise when designing a ER model. These are known as connection traps.  There are two main types of connection traps: 1. Fan traps 2. Chasm traps
  • 71. Fan Traps  Fan traps occur in a situation when a model represents relationship between entity types however a path between certain entity occurrences is ambiguous.  Example: (Staff)-1:N-works in-1-(Campus)-1-has-1:N-(Department).  In this model, it may be impossible to determine the department a staff belongs to. DepartmentStaff Campus 1 1 1..*1..*
  • 72. Entity Relationship Modelling 2 Topic 4 - 4.72 © NCC Education LimitedV1.0 Fan Traps - 1 Campus ID Campus Name C1 London C2 Lagos C3 Cairo Staff ID Name Campus ID (FK) S1 Eric Hudson C2 S2 Sandra Smith C1 S3 Malia Shah C1 Department ID Name Campus ID (FK) D1 Humanities C1 D2 Computing C2 D3 Maths C2 Campus Staff Department In which Department does Eric work?
  • 73. Fan Traps – The Solution  Restructuring the model resolves trap (Campus)-1-has-1:N- (Department)-1-has-1:N-(Staff) CampusStaff Department 1 1..* 11..*
  • 74. Entity Relationship Modelling 2 Topic 4 - 4.74 © NCC Education LimitedV1.0 Fan Traps - 2 Campus ID Campus Name C1 London C2 Lagos C3 Cairo Staff ID Name Department ID (FK) S1 Eric Hudson D3 S2 Sandra Smith D1 S3 Malia Shah D1 Department ID Name Campus ID (FK) D1 Humanities C1 D2 Computing C2 D3 Maths C2 Campus Staff Department We now know in which department Eric works
  • 75. Chasm Traps  Chasm Traps occur where there are relationships between entities, but one of the relationships is non-mandatory.  A model suggests the existence of a relationship between entity types, but the pathway does not exist between certain entity occurrences. This connection traps is known as Chasm Traps.  http://db.grussell.org/section005.html
  • 76. Chasm Traps – The Problem  A branch has many staff members who manage properties, but not all properties are managed by a member of staff, and not all staff manage properties. Staff PropertyBranch 1...* 0...*0...11
  • 77. Entity Relationship Modelling 2 Topic 4 - 4.77 © NCC Education LimitedV1.0 Chasm Trap - 1 Branch ID Branch Name 1 Ilford 2 Redbridge Staff ID Name Branch ID (FK) S1 Davinda 1 S2 Roberta 1 S3 Eddie 2 Property ID Property Name Staff ID (FK) P1 Yap Mansions S1 P2 Hill House P2 Usher House S2 Branch Staff Property Which Branch manages ‘Hill House’?
  • 78. Chasm Traps – The Solution  The solution is to change the structure and represent both relationships. Property Staff Branch 1...* 0...*0...11 1 0...*
  • 79. Chasm Traps – The Solution Branch ID Branch Name 1 Ilford 2 Redbridge Staff ID Name Branch ID (FK) S1 Davinda 1 S2 Roberta 1 S3 Eddie 2 Property ID Property Name Staff ID (FK) Branch ID (FK) P1 Yap Mansions S1 1 P2 Hill House 2 P3 Usher House S2 1 Branch Staff Property We now know which Branch manages ‘Hill House’
  • 80. References  http://www.studytonight.com/dbms/er-diagram.php  http://www.blackwasp.co.uk/SQLDerivedTables.aspx  http://www2.cs.uregina.ca/~bernatja/crowsfoot.html  http://revj.sourceforge.net/traps.html  http://db.grussell.org/section005.html  http://www.tutorialspoint.com/dbms/dbms_data_independence.htm  http://en.wikipedia.org/wiki/Three_schema_approach  http://en.wikipedia.org/wiki/Data_independence  http://www.tutorialspoint.com/dbms/er_model_basic_concepts.htm
  • 81. END OF TOPIC 3 Any Questions

Editor's Notes

  1. Best Example Link for ER Modelling: http://www.tutorialspoint.com/dbms/er_model_basic_concepts.htm
  2. Remove this slide
  3. abstract => theoretical, conceptual
  4. eg. student takes course. In this example, course is considered as weak entity because, if there are no students to take a particular course, then that course cannot be offered. The COURSE entity depends on the STUDENT entity.
  5. Model – Nano Car Car – Car 1, Car 2, etc
  6. Model – Nano Car Car – Car 1, Car 2, etc