DATA BASE MANAGEMENT
SYSTEM
CHAPTER-1 – ER DIAGRAM
•PROFILE
•Jiban Jyoti Dash
• GATE AIR 90 ,213, 469, 720, 1220
• MTech(CS) from IIT Delhi
• Selected in various organizations like
BARC,NTRO,IOCL,PGCIL,CIL,NLC,DVC,NTPC
etc…
• Experience of teaching & mentoring in
various EdTech platforms
• Contacts Details:-
• Mail ID- jjdas1191@gmail.com
• Contact Number - +91 9853427707
•Data are characteristics, usually numerical, that
are collected through observation. In a more
technical sense, data are a set of values of
qualitative or quantitative variables about one or
more persons or objects, while a datum (singular
of data) is a single value of a single variable
DATA
• Any facts and figures about an entity is called as
Data.
•Information
• Although the terms "data" and "information" are
often used interchangeably, these terms have
distinct meanings. In some popular
publications, data are sometimes said to be
transformed into information when they are
viewed in context or in post-analysis.
• Processed Data is called information.
• Data Base
• • A database is an organized collection of
data, generally stored and accessed
electronically from a computer system.
• Data Base Management System
• The database management system
(DBMS) is the software that interacts with
end users, applications, and the database
itself to capture and analyze the data.
• The DBMS software additionally
encompasses the core facilities provided
to administer the database. The sum total
of the database, the DBMS and the
associated applications can be referred to
as a "database system".
• Problem With File System
• Data redundancy and inconsistency: Imagine
two spreadsheets that list employee contacts, but
one is updated with a new phone number while
the other is not, leading to confusion about the
correct number to use.
• Difficulty in accessing Data: Consider needing a
specific report from a database, but you have to
request it from an IT specialist instead of getting it
yourself directly, causing delays.
• Data Isolation: If customer profiles are stored in
one system and their order histories in another,
merging this information for a comprehensive
view can be cumbersome. Integrity Problem:
After a customer updates their address on one
page of a website, they find the old address on
another page because the change did not carry
through all systems.
• Atomicity Problem: A banking transaction that
deducts money from one account but fails to
deposit it in another leaves the transaction
incomplete and accounts unbalanced.
• Concurrent access Anomalies: Two people
booking the last ticket on a flight at the same time
might both get a confirmation, but only one can
actually get the seat.
• Instance and Schemas
• The collection of information stored in the database at a particular moment is called an
instance of the database.
•The overall design of the database is called the database schema.
E-R DIAGRAM/MODEL
•Introduced in 1976 by Dr Peter Chen, a non-
technical design method works on conceptual
level based on the perception of the real world.
•E-R data model was developed to facilitate
database design by allowing specification of an
enterprise schema that represents the overall
logical structure of a database.
Conclusion
• It consists of collections of basic
objects, called entities and of
relationships among these entities
and attributes which defines their
properties.
• E-R model is very useful in mapping
the meanings and interactions of
real-world enterprises onto a
conceptual schema.
• It is free from ambiguities and
provides a standard and logical way
of visualizing the data.
• As basically it is a diagrammatical
representation easy to understand
even by a non-technical user.
ENTITY
• ENTITY
• An entity is a thing or an object in the real
world that is distinguishable from other
object based on the values of the attributes
it possesses.
• An entity may be concrete, such as a
person or a book, or it may be abstract,
such as a course, a course offering, or a
flight reservation.
• Types of Entity
• Tangible - Entities which physically
exist in real world. E.g. - Car, Pen,
locker
• Intangible - Entities which exist
logically. E.g. – Account, video.
• ENTIY SET- Collection of same type of
entities that share the same properties
or attributes. In an ER diagram an
entity set is represented by a rectangle.
In a relational model it is represented
by a separate table.
• In ER diagram we cannot represent an entity,
as entity is an instant not schema, and ER
diagram is designed to understand schema.
• In a relational model entity is represented by
a row or a tuple or a record in a table.
• ATTRIBUTES
• Attributes are the units defines and
describe properties and characteristics of
entities. Attributes are the descriptive
properties possessed by each member of
an entity set. for each attribute there is a
set of permitted values called domain.
• In an ER diagram
attributes are
represented by ellipse or
oval connected to
rectangle.
• While in a relational
model they are
represented by
independent column.
e.g. Instructor (ID, name,
salary, dept_name)
• Single valued- Attributes having
single value at any instance of
time for an entity. E.g. – Aadhar
no, dob.
• Multivalued - Attributes which
can have more than one value for
an entity at same time. E.g. -
Phone no, email, address.
• A multivalued attribute is
represented by a double ellipse in
an ER diagram and by an
independent table in a relational
model.
• Separate table for each
multivalued attribute, by taking
mva and pk of main table as fk in
new table
Cust omer
Customer ID First Name Surname Telephone Number
123 Pooja Singh 555-861-2025, 192-122-1111
456 San Zhang
(555) 403-1659 Ext. 53; 182-929-
2929
789 John Doe 555-808-9633
• Simple - Attributes which cannot be
divided further into sub parts. E.g.
Age
• Composite - Attributes which can be
further divided into sub parts, as
simple attributes. A composite
attribute is represented by an ellipse
connected to an ellipse and in a
relational model by a separate
column.
• Stored - Main attributes
whose value is permanently
stored in database. E.g.
• date_of_birth
• Derived -The value of these
types of attributes can be
derived from values of
other
•Attributes. E.g. - Age
attribute can be derived
from date_of_birth and Date
attribute.
•Descriptive attribute - Attribute of
relationship is called descriptive attribute.
•An attribute takes a null value when an
entity does not have a value for it. The null
value may indicate “not applicable”— that is,
that the value does not exist for the entity
•Null can also designate that an attribute
value is unknown. An unknown value may
be either missing (the value does exist, but
we do not have that information) or not
known (we do not know whether or not the
value actually exists).
• In an ER diagram it is represented by a
diamond, while in relational model
sometimes through foreign key and
other time by a separate table.
Relationship / Association
• Is an association between two
or more entities of same or
different entity set.
• In ER diagram we cannot
represent individual
relationship as it is an
instance or data.
•Every relationship type has three components.
•1-Name- Every relation must have a unique
name.
•2-Degree-
3-Structural constraints (cardinalities ratios,
participation)
• Degree of a relationship/Relationship Set
• Means number of entities set(relations/tables) associated(participate) in the relationship
set.
• Most of the relationship sets in a data base system are binary.
• Occasionally however relationship sets involve more than two entity sets.
• Logically, we can associate any number of entity set in a relationship called N-ary
Relationship.
• Unary Relationship - One single entity set participate in
a Relationship, means two entities of the same entity set
are related to each other.
• These are also called as self -referential Relationship set.
• E.g.- A member in a team maybe supervisor of another
member in team.
Binary Relationship - Two entity
sets participate in a Relationship.
It is most common form of
relationship.
• Ternary Relationship - When
three entities participate in a
Relationship. E.g. The University
might need to record which
teachers taught which subjects
in which courses.
• Quaternary Relationship - When
four entities participate in a
Relationship.
• N-ary relationship – where n
number of entity set are associated
• Structural constraints (Cardinalities Ratios, Participation)
• An E-R enterprise schema may define certain constraints to
which the contents of a database must conform.
• Express the number of entities to which another entity can be
associated via a relationship set. Four possible categories are
• One to One (1:1) Relationship.
• One to Many (1: M) Relationship.
• Many to One (M: 1) Relationship.
• Many to Many (M: N) Relationship.
•One to One (1:1) Relationship - An entity in A is
associated with at most one entity in B, and an
entity in B is associated with at most one entity in
A.
E.g.- The directed line from relationship set advisor to both
entities set indicates that ‘an instructor may advise at most one
student, and a student may have at most one advisor’.
One to Many (1: M) Relationship - An entity in A is associated
with any number (zero or more) of entities in B. An entity in B,
however, can be associated with at most one entity in A.
E.g.- This indicates that an instructor may advise many
students, but a student may have at most one advisor.
•Many to One (M: 1) Relationship - An entity in A
is associated with at most one entity in B. An entity
in B, however, can be associated with any number
(zero or more ) of entities in A.
•E.g.- This indicates that student may have many
instructors but an instructor can advise at most
one student.
Many to Many(M:N) Relationship - An entity in A is associated
with any number (zero or more) of entities in B, and an entity in
B is associated with any number (zero or more) of entities in A.
E.g.- This indicates a student may have many advisors and an
instructor may advise many students.
• Participation Constraints
• Participation constraint specifies whether
the existence of an entity depends on its
being related to another entity via the
relationship type.
• These constraints specify the minimum and
maximum number of relationship
instances that each entity must/can
participate in.
• Max cardinality – it defines the maximum
no of times an entity occurrence
participating in a relationship.
• Min cardinality - it defines the minimum no
of times an entity occurrence participating
in a relationship.
• PARTICIPATION CONSTRAINTS- it defines participations of
entities of an entity type in a relationship.
• PARTIAL PARTICIPATION (min cardinality zero) - In Partial
participation only some entities of entity set participate in
Relationship set, that is there exists at least one entity which do
not participate in a relation.
• TOTAL PARTICIPATION (min cardinality at least one) - In total
participation every entity of an entity set participates in at least
one relationship in Relationship set.
• Conversion of 1-1 relationship(binary)
• No separate table is required, take pk of one side as pk on
other side, priority must be given to the side having total
participation.
• Conversion of 1-n or n-1 relationship (binary)
• No separate table is required, modify n side by taking pk of 1
side a foreign key on n side.
• Conversion of n-n relationship (binary)
• Separate table is required take pk of both table and declare their
combination as a pk of new table
•Q In an Entity-Relationship (ER) model, suppose R is a many-to-one
relationship from entity set E1 to entity set E2. Assume that E1 and E2 participate
totally in R and that the cardinality of E1 is greater than the cardinality of E2.
Which one of the following is true about R?
A) Every entity in E1 is associated with exactly one entity in E2
B) Some entity in E1 is associated with more than one entity in E2
C) Every entity in E2 is associated with exactly one entity in E1
D) Every entity in E2 is associated with at most one entity in E1
•Q Given the basic ER and relational models, which of the following
is INCORRECT?
A) An attribute of an entity can have more than one value
B) An attribute of an entity can be composite
C) In a row of a relational table, an attribute can have more than
one value
D) In a row of a relational table, an attribute can have exactly one
value or a NULL value
Consider the entities ‘hotel room’, and ‘person’ with a many to
many relationship ‘lodging’ as shown below:
If we wish to store information about the rent payment
to be made by person (s) occupying different hotel
rooms, then this information should appear as an
attribute of
A) Person
B) Hotel Room
C) Lodging
D) None of these
• STRONG AND WEAK ENTITY SET
• An entity set is called strong entity set, if it
has a primary key, all the tuples in the set
are distinguishable by that key.
• An entity set that does not process
sufficient attributes to form a primary key
is called a weak entity set
• It contains discriminator attributes (partial
key) which contain partial information
about the entity set, but it is not sufficient
enough to identify each tuple uniquely.
Represented by double rectangle.
• .
• For a weak entity set to be meaningful and converted into
strong entity set, it must be associated with another
strong entity set called the identifying or owner entity
set i.e. weak entity set is said to be existence dependent
on the identity set.
• The identifying entity set is said to own weak entity set
that it identifies.
• A weak entity set may participate as owner in an
identifying relationship with another weak entity set.
• The relationship associating the weak entity set with the
identifying entity set is called the identifying
relationship (double diamonds).
• The identifying relationship is many to one from the weak
entity set to identifying entity set, and the participation of
the weak entity set in relationship is always total.
• The primary key of weak entity set will be the
union of primary key and discriminator attributes.
• REASONS TO HAVE WEAK ENTITY SET
• Weak entities reflect the logical structure of an entity being dependent
on another.
• Weak entity can be deleted automatically when their strong entity is
deleted.
• Without weak entity set it will lead to duplication and consequent
possible inconsistencies.
Converting ER
Diagrams to Tables
Reasons:-
•ER diagram is converted into the tables in relational model.
•This is because relational models can be easily implemented
by RDBMS like MySQL , Oracle etc.
Rule-01: For Strong Entity Set With Only Simple
Attributes-
A strong entity set with only simple attributes will
require only one table in relational model.
•Attributes of the table will be the attributes of the
entity set.
•The primary key of the table will be the key attribute
of the entity set.
Rule-02: For Strong Entity Set With Composite
Attributes-
•A strong entity set with any number of composite
attributes will require only one table in relational model.
•While conversion, simple attributes of the composite
attributes are taken into account and not the composite
attribute itself.
Rule-03: For Strong Entity Set With Multi Valued
Attributes-
A strong entity set with any number of multi valued
attributes will require two tables in relational model.
•One table will contain all the simple attributes with the
primary key.
•Other table will contain the primary key and all the multi
valued attributes.
Rule-04: Translating Relationship Set into
a Table-
A relationship set will require one table in the
relational model.
Attributes of the table are-
•Primary key attributes of the participating entity
sets
•Its own descriptive attributes if any.
Set of non-descriptive attributes will be the
primary key.
NOTE-
If we consider the overall ER diagram, three tables will be
required in relational model-
•One table for the entity set “Employee”
•One table for the entity set “Department”
•One table for the relationship set “Works in”
Rule-05: For Binary Relationships With Cardinality Ratios-
The following four cases are possible-
•Case-01: Binary relationship with cardinality ratio m:n
•Case-02: Binary relationship with cardinality ratio 1:n
•Case-03: Binary relationship with cardinality ratio m:1
•Case-04: Binary relationship with cardinality ratio 1:1
Case-01: For Binary Relationship With Cardinality
Ratio m:n
Here, three tables will be required-
1.A ( a1 , a2 )
2.R ( a1 , b1 )
3.B ( b1 , b2 )
Case-02: For Binary Relationship With Cardinality
Ratio 1:n
Here, two tables will be required-
1.A ( a1 , a2 )
2.BR ( a1 , b1 , b2 )
NOTE- Here, combined table will be drawn for the entity set
B and relationship set R.
Case-03: For Binary Relationship With Cardinality
Ratio m:1
Here, two tables will be required-
1.AR ( a1 , a2 , b1 )
2.B ( b1 , b2 )
NOTE- Here, combined table will be drawn for the entity set
A and relationship set R.
Case-04: For Binary Relationship With Cardinality
Ratio 1:1
Here, two tables will be required. Either combine ‘R’ with
‘A’ or ‘B’
Way-01:
1.AR ( a1 , a2 , b1 )
2.B ( b1 , b2 )
Way-02:
3.A ( a1 , a2 )
4.BR ( a1 , b1 , b2 )
•Consolidation of Rule-05
•
•While determining the minimum number of tables required for binary
relationships with given cardinality ratios, following thumb rules must be kept in
mind-
•For binary relationship with cardinality ration m : n , separate and individual
tables will be drawn for each entity set and relationship.
•For binary relationship with cardinality ratio either m : 1 or 1 : n , always
remember “many side will consume the relationship” i.e. a combined table will be
drawn for many side entity set and relationship set.
•For binary relationship with cardinality ratio 1 : 1 , two tables will be required. You
can combine the relationship set with any one of the entity sets.
Rule-06: For Binary Relationship With Both Cardinality Constraints and
Participation Constraints-
•Cardinality constraints will be implemented as discussed in Rule-05.
•Because of the total participation constraint, foreign key acquires NOT NULL constraint i.e. now
foreign key can not be null.
Case-01: For Binary Relationship With Cardinality
Constraint and Total Participation Constraint From
One Side-
Because cardinality ratio = 1 : n , so we will combine the entity set B and relationship set R
Then, two tables will be required-
1.A ( a1 , a2 )
2.BR ( a1 , b1 , b2 )
Because of total participation, foreign key a1 has acquired NOT NULL constraint, so it can’t be null now.
Case-02: For Binary Relationship With Cardinality Constraint and Total Participation
Constraint From Both Sides-
If there is a key constraint from both the sides of an entity set with total participation, then that binary
relationship is represented using only single table.
Here, Only one table is required.
•ARB ( a1 , a2 , b1 , b2 )
Rule-07: For Binary Relationship With Weak Entity Set-
Weak entity set always appears in association with identifying relationship with total participation
constraint.
Here, two tables will be required-
1.A ( a1 , a2 )
2.BR ( a1 , b1 , b2 )
Problem-01:
Find the minimum number of tables required for the following ER diagram in relational model-
Problem-02:
Find the minimum number of tables required to represent the given ER diagram in relational
model-
Problem-03:
Find the minimum number of tables required to represent the given ER diagram in relational
model-
Problem-04:
Find the minimum number of tables required to represent the given
ER diagram in relational model-
Problem-05:
Find the minimum
number of tables
required to
represent the given
ER diagram in
relational model-
Problem-06:
The minimum
number of tables
required to
convert the
following ER
diagram to
relation model is
•Problem-07:
The minimum number
of tables required to
convert the following ER
diagram to Relational
model is ____________
Problem-08:
THANK YOU FOR ANY QUERY CONTACT
ME OVER EMAIL ID ,
WHATSAPP

ER-Diagram.pptx , ER diagram , entity reltaionship diagram , data base

  • 1.
  • 2.
    •PROFILE •Jiban Jyoti Dash •GATE AIR 90 ,213, 469, 720, 1220 • MTech(CS) from IIT Delhi • Selected in various organizations like BARC,NTRO,IOCL,PGCIL,CIL,NLC,DVC,NTPC etc… • Experience of teaching & mentoring in various EdTech platforms • Contacts Details:- • Mail ID- jjdas1191@gmail.com • Contact Number - +91 9853427707
  • 3.
    •Data are characteristics,usually numerical, that are collected through observation. In a more technical sense, data are a set of values of qualitative or quantitative variables about one or more persons or objects, while a datum (singular of data) is a single value of a single variable DATA • Any facts and figures about an entity is called as Data.
  • 4.
    •Information • Although theterms "data" and "information" are often used interchangeably, these terms have distinct meanings. In some popular publications, data are sometimes said to be transformed into information when they are viewed in context or in post-analysis. • Processed Data is called information.
  • 5.
    • Data Base •• A database is an organized collection of data, generally stored and accessed electronically from a computer system.
  • 6.
    • Data BaseManagement System • The database management system (DBMS) is the software that interacts with end users, applications, and the database itself to capture and analyze the data. • The DBMS software additionally encompasses the core facilities provided to administer the database. The sum total of the database, the DBMS and the associated applications can be referred to as a "database system".
  • 7.
    • Problem WithFile System • Data redundancy and inconsistency: Imagine two spreadsheets that list employee contacts, but one is updated with a new phone number while the other is not, leading to confusion about the correct number to use. • Difficulty in accessing Data: Consider needing a specific report from a database, but you have to request it from an IT specialist instead of getting it yourself directly, causing delays. • Data Isolation: If customer profiles are stored in one system and their order histories in another, merging this information for a comprehensive view can be cumbersome. Integrity Problem: After a customer updates their address on one page of a website, they find the old address on another page because the change did not carry through all systems. • Atomicity Problem: A banking transaction that deducts money from one account but fails to deposit it in another leaves the transaction incomplete and accounts unbalanced. • Concurrent access Anomalies: Two people booking the last ticket on a flight at the same time might both get a confirmation, but only one can actually get the seat.
  • 8.
    • Instance andSchemas • The collection of information stored in the database at a particular moment is called an instance of the database. •The overall design of the database is called the database schema.
  • 9.
    E-R DIAGRAM/MODEL •Introduced in1976 by Dr Peter Chen, a non- technical design method works on conceptual level based on the perception of the real world. •E-R data model was developed to facilitate database design by allowing specification of an enterprise schema that represents the overall logical structure of a database.
  • 11.
    Conclusion • It consistsof collections of basic objects, called entities and of relationships among these entities and attributes which defines their properties. • E-R model is very useful in mapping the meanings and interactions of real-world enterprises onto a conceptual schema. • It is free from ambiguities and provides a standard and logical way of visualizing the data. • As basically it is a diagrammatical representation easy to understand even by a non-technical user.
  • 12.
  • 13.
    • ENTITY • Anentity is a thing or an object in the real world that is distinguishable from other object based on the values of the attributes it possesses. • An entity may be concrete, such as a person or a book, or it may be abstract, such as a course, a course offering, or a flight reservation.
  • 14.
    • Types ofEntity • Tangible - Entities which physically exist in real world. E.g. - Car, Pen, locker • Intangible - Entities which exist logically. E.g. – Account, video.
  • 15.
    • ENTIY SET-Collection of same type of entities that share the same properties or attributes. In an ER diagram an entity set is represented by a rectangle. In a relational model it is represented by a separate table.
  • 16.
    • In ERdiagram we cannot represent an entity, as entity is an instant not schema, and ER diagram is designed to understand schema. • In a relational model entity is represented by a row or a tuple or a record in a table. • ATTRIBUTES • Attributes are the units defines and describe properties and characteristics of entities. Attributes are the descriptive properties possessed by each member of an entity set. for each attribute there is a set of permitted values called domain.
  • 17.
    • In anER diagram attributes are represented by ellipse or oval connected to rectangle. • While in a relational model they are represented by independent column. e.g. Instructor (ID, name, salary, dept_name)
  • 18.
    • Single valued-Attributes having single value at any instance of time for an entity. E.g. – Aadhar no, dob. • Multivalued - Attributes which can have more than one value for an entity at same time. E.g. - Phone no, email, address. • A multivalued attribute is represented by a double ellipse in an ER diagram and by an independent table in a relational model. • Separate table for each multivalued attribute, by taking mva and pk of main table as fk in new table
  • 19.
    Cust omer Customer IDFirst Name Surname Telephone Number 123 Pooja Singh 555-861-2025, 192-122-1111 456 San Zhang (555) 403-1659 Ext. 53; 182-929- 2929 789 John Doe 555-808-9633
  • 21.
    • Simple -Attributes which cannot be divided further into sub parts. E.g. Age • Composite - Attributes which can be further divided into sub parts, as simple attributes. A composite attribute is represented by an ellipse connected to an ellipse and in a relational model by a separate column.
  • 22.
    • Stored -Main attributes whose value is permanently stored in database. E.g. • date_of_birth • Derived -The value of these types of attributes can be derived from values of other •Attributes. E.g. - Age attribute can be derived from date_of_birth and Date attribute.
  • 23.
    •Descriptive attribute -Attribute of relationship is called descriptive attribute. •An attribute takes a null value when an entity does not have a value for it. The null value may indicate “not applicable”— that is, that the value does not exist for the entity •Null can also designate that an attribute value is unknown. An unknown value may be either missing (the value does exist, but we do not have that information) or not known (we do not know whether or not the value actually exists).
  • 24.
    • In anER diagram it is represented by a diamond, while in relational model sometimes through foreign key and other time by a separate table. Relationship / Association • Is an association between two or more entities of same or different entity set. • In ER diagram we cannot represent individual relationship as it is an instance or data.
  • 25.
    •Every relationship typehas three components. •1-Name- Every relation must have a unique name. •2-Degree- 3-Structural constraints (cardinalities ratios, participation)
  • 26.
    • Degree ofa relationship/Relationship Set • Means number of entities set(relations/tables) associated(participate) in the relationship set. • Most of the relationship sets in a data base system are binary. • Occasionally however relationship sets involve more than two entity sets. • Logically, we can associate any number of entity set in a relationship called N-ary Relationship.
  • 27.
    • Unary Relationship- One single entity set participate in a Relationship, means two entities of the same entity set are related to each other. • These are also called as self -referential Relationship set. • E.g.- A member in a team maybe supervisor of another member in team.
  • 28.
    Binary Relationship -Two entity sets participate in a Relationship. It is most common form of relationship. • Ternary Relationship - When three entities participate in a Relationship. E.g. The University might need to record which teachers taught which subjects in which courses.
  • 29.
    • Quaternary Relationship- When four entities participate in a Relationship. • N-ary relationship – where n number of entity set are associated
  • 30.
    • Structural constraints(Cardinalities Ratios, Participation) • An E-R enterprise schema may define certain constraints to which the contents of a database must conform. • Express the number of entities to which another entity can be associated via a relationship set. Four possible categories are • One to One (1:1) Relationship. • One to Many (1: M) Relationship. • Many to One (M: 1) Relationship. • Many to Many (M: N) Relationship.
  • 31.
    •One to One(1:1) Relationship - An entity in A is associated with at most one entity in B, and an entity in B is associated with at most one entity in A. E.g.- The directed line from relationship set advisor to both entities set indicates that ‘an instructor may advise at most one student, and a student may have at most one advisor’.
  • 32.
    One to Many(1: M) Relationship - An entity in A is associated with any number (zero or more) of entities in B. An entity in B, however, can be associated with at most one entity in A. E.g.- This indicates that an instructor may advise many students, but a student may have at most one advisor.
  • 33.
    •Many to One(M: 1) Relationship - An entity in A is associated with at most one entity in B. An entity in B, however, can be associated with any number (zero or more ) of entities in A. •E.g.- This indicates that student may have many instructors but an instructor can advise at most one student.
  • 34.
    Many to Many(M:N)Relationship - An entity in A is associated with any number (zero or more) of entities in B, and an entity in B is associated with any number (zero or more) of entities in A. E.g.- This indicates a student may have many advisors and an instructor may advise many students.
  • 35.
    • Participation Constraints •Participation constraint specifies whether the existence of an entity depends on its being related to another entity via the relationship type. • These constraints specify the minimum and maximum number of relationship instances that each entity must/can participate in. • Max cardinality – it defines the maximum no of times an entity occurrence participating in a relationship. • Min cardinality - it defines the minimum no of times an entity occurrence participating in a relationship.
  • 36.
    • PARTICIPATION CONSTRAINTS-it defines participations of entities of an entity type in a relationship. • PARTIAL PARTICIPATION (min cardinality zero) - In Partial participation only some entities of entity set participate in Relationship set, that is there exists at least one entity which do not participate in a relation. • TOTAL PARTICIPATION (min cardinality at least one) - In total participation every entity of an entity set participates in at least one relationship in Relationship set. • Conversion of 1-1 relationship(binary) • No separate table is required, take pk of one side as pk on other side, priority must be given to the side having total participation. • Conversion of 1-n or n-1 relationship (binary) • No separate table is required, modify n side by taking pk of 1 side a foreign key on n side. • Conversion of n-n relationship (binary) • Separate table is required take pk of both table and declare their combination as a pk of new table
  • 37.
    •Q In anEntity-Relationship (ER) model, suppose R is a many-to-one relationship from entity set E1 to entity set E2. Assume that E1 and E2 participate totally in R and that the cardinality of E1 is greater than the cardinality of E2. Which one of the following is true about R? A) Every entity in E1 is associated with exactly one entity in E2 B) Some entity in E1 is associated with more than one entity in E2 C) Every entity in E2 is associated with exactly one entity in E1 D) Every entity in E2 is associated with at most one entity in E1
  • 38.
    •Q Given thebasic ER and relational models, which of the following is INCORRECT? A) An attribute of an entity can have more than one value B) An attribute of an entity can be composite C) In a row of a relational table, an attribute can have more than one value D) In a row of a relational table, an attribute can have exactly one value or a NULL value
  • 39.
    Consider the entities‘hotel room’, and ‘person’ with a many to many relationship ‘lodging’ as shown below: If we wish to store information about the rent payment to be made by person (s) occupying different hotel rooms, then this information should appear as an attribute of A) Person B) Hotel Room C) Lodging D) None of these
  • 40.
    • STRONG ANDWEAK ENTITY SET • An entity set is called strong entity set, if it has a primary key, all the tuples in the set are distinguishable by that key. • An entity set that does not process sufficient attributes to form a primary key is called a weak entity set • It contains discriminator attributes (partial key) which contain partial information about the entity set, but it is not sufficient enough to identify each tuple uniquely. Represented by double rectangle. • .
  • 41.
    • For aweak entity set to be meaningful and converted into strong entity set, it must be associated with another strong entity set called the identifying or owner entity set i.e. weak entity set is said to be existence dependent on the identity set. • The identifying entity set is said to own weak entity set that it identifies. • A weak entity set may participate as owner in an identifying relationship with another weak entity set. • The relationship associating the weak entity set with the identifying entity set is called the identifying relationship (double diamonds). • The identifying relationship is many to one from the weak entity set to identifying entity set, and the participation of the weak entity set in relationship is always total.
  • 42.
    • The primarykey of weak entity set will be the union of primary key and discriminator attributes.
  • 43.
    • REASONS TOHAVE WEAK ENTITY SET • Weak entities reflect the logical structure of an entity being dependent on another. • Weak entity can be deleted automatically when their strong entity is deleted. • Without weak entity set it will lead to duplication and consequent possible inconsistencies.
  • 44.
  • 45.
    Reasons:- •ER diagram isconverted into the tables in relational model. •This is because relational models can be easily implemented by RDBMS like MySQL , Oracle etc.
  • 46.
    Rule-01: For StrongEntity Set With Only Simple Attributes- A strong entity set with only simple attributes will require only one table in relational model. •Attributes of the table will be the attributes of the entity set. •The primary key of the table will be the key attribute of the entity set.
  • 47.
    Rule-02: For StrongEntity Set With Composite Attributes- •A strong entity set with any number of composite attributes will require only one table in relational model. •While conversion, simple attributes of the composite attributes are taken into account and not the composite attribute itself.
  • 48.
    Rule-03: For StrongEntity Set With Multi Valued Attributes- A strong entity set with any number of multi valued attributes will require two tables in relational model. •One table will contain all the simple attributes with the primary key. •Other table will contain the primary key and all the multi valued attributes.
  • 49.
    Rule-04: Translating RelationshipSet into a Table- A relationship set will require one table in the relational model. Attributes of the table are- •Primary key attributes of the participating entity sets •Its own descriptive attributes if any. Set of non-descriptive attributes will be the primary key. NOTE- If we consider the overall ER diagram, three tables will be required in relational model- •One table for the entity set “Employee” •One table for the entity set “Department” •One table for the relationship set “Works in”
  • 50.
    Rule-05: For BinaryRelationships With Cardinality Ratios- The following four cases are possible- •Case-01: Binary relationship with cardinality ratio m:n •Case-02: Binary relationship with cardinality ratio 1:n •Case-03: Binary relationship with cardinality ratio m:1 •Case-04: Binary relationship with cardinality ratio 1:1
  • 51.
    Case-01: For BinaryRelationship With Cardinality Ratio m:n Here, three tables will be required- 1.A ( a1 , a2 ) 2.R ( a1 , b1 ) 3.B ( b1 , b2 )
  • 52.
    Case-02: For BinaryRelationship With Cardinality Ratio 1:n Here, two tables will be required- 1.A ( a1 , a2 ) 2.BR ( a1 , b1 , b2 ) NOTE- Here, combined table will be drawn for the entity set B and relationship set R.
  • 53.
    Case-03: For BinaryRelationship With Cardinality Ratio m:1 Here, two tables will be required- 1.AR ( a1 , a2 , b1 ) 2.B ( b1 , b2 ) NOTE- Here, combined table will be drawn for the entity set A and relationship set R.
  • 54.
    Case-04: For BinaryRelationship With Cardinality Ratio 1:1 Here, two tables will be required. Either combine ‘R’ with ‘A’ or ‘B’ Way-01: 1.AR ( a1 , a2 , b1 ) 2.B ( b1 , b2 ) Way-02: 3.A ( a1 , a2 ) 4.BR ( a1 , b1 , b2 )
  • 55.
    •Consolidation of Rule-05 • •Whiledetermining the minimum number of tables required for binary relationships with given cardinality ratios, following thumb rules must be kept in mind- •For binary relationship with cardinality ration m : n , separate and individual tables will be drawn for each entity set and relationship. •For binary relationship with cardinality ratio either m : 1 or 1 : n , always remember “many side will consume the relationship” i.e. a combined table will be drawn for many side entity set and relationship set. •For binary relationship with cardinality ratio 1 : 1 , two tables will be required. You can combine the relationship set with any one of the entity sets.
  • 56.
    Rule-06: For BinaryRelationship With Both Cardinality Constraints and Participation Constraints- •Cardinality constraints will be implemented as discussed in Rule-05. •Because of the total participation constraint, foreign key acquires NOT NULL constraint i.e. now foreign key can not be null. Case-01: For Binary Relationship With Cardinality Constraint and Total Participation Constraint From One Side- Because cardinality ratio = 1 : n , so we will combine the entity set B and relationship set R Then, two tables will be required- 1.A ( a1 , a2 ) 2.BR ( a1 , b1 , b2 ) Because of total participation, foreign key a1 has acquired NOT NULL constraint, so it can’t be null now.
  • 57.
    Case-02: For BinaryRelationship With Cardinality Constraint and Total Participation Constraint From Both Sides- If there is a key constraint from both the sides of an entity set with total participation, then that binary relationship is represented using only single table. Here, Only one table is required. •ARB ( a1 , a2 , b1 , b2 )
  • 58.
    Rule-07: For BinaryRelationship With Weak Entity Set- Weak entity set always appears in association with identifying relationship with total participation constraint. Here, two tables will be required- 1.A ( a1 , a2 ) 2.BR ( a1 , b1 , b2 )
  • 59.
    Problem-01: Find the minimumnumber of tables required for the following ER diagram in relational model-
  • 60.
    Problem-02: Find the minimumnumber of tables required to represent the given ER diagram in relational model-
  • 61.
    Problem-03: Find the minimumnumber of tables required to represent the given ER diagram in relational model-
  • 62.
    Problem-04: Find the minimumnumber of tables required to represent the given ER diagram in relational model-
  • 63.
    Problem-05: Find the minimum numberof tables required to represent the given ER diagram in relational model-
  • 64.
    Problem-06: The minimum number oftables required to convert the following ER diagram to relation model is
  • 65.
    •Problem-07: The minimum number oftables required to convert the following ER diagram to Relational model is ____________
  • 66.
  • 67.
    THANK YOU FORANY QUERY CONTACT ME OVER EMAIL ID , WHATSAPP