Professional Documents
Culture Documents
Data Models-E-R
Data Models-E-R
Data Model
A data model is a collection of conceptual tools for describing data,
data relationship, data semantics and consistency constraints.
Entity Set
An entity set is a set of entities of the same type that share the
same properties, or attributes.
Null Value: An attribute can take a null value when an entity does
not have a value for it.
Relationship Set
A relationship set is a set of relationships of the same type.
1. One to one
2. One to many
3. Many to one
4. Many to many
One to one 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
The values of the attributes of an entity must be such that they can
uniquely identify the entity from the entity set. In other words, no
two entities in an entity set are allowed to have exactly the same
value for all attributes.
B. Relationship Sets
Superkey
Let R be a relationship set involving entity sets E1, E2, .., En. Let
Primary Key (Ei ) denote the set of attributes that forms the primary
key for entity set Ei. Assume for now that the attribute names of all
the primary keys are unique, and each entity set participates only
ones in the relationship. The composition of the primary key for a
relationship set depends on the set of attributes associated with the
relationship set R.
i) If the relationship set R has no attributes associated with
it (descriptive attribute/s), then the set of attributes
Primary Key (E1 ) U Primary Key (E2 ) U..U Primary Key
(En )
describes an individual relationship in set R.
Strong Entity Set: An entity set that has a primary key is termed
as strong entity set.
Weak Entity Set: An entity set may not have sufficient attributes to
form a primary key. Such an entity set is termed as weak entity set.
Payment = (payment-number, payment-date, payment-amount)
The identifying entity set is said to own the weak entity set that it
identifies.
Identifying Relationship: The relationship associating the weak
entity set with the identifying entity set is called the identifying
relationship.
The primary key of the identifying entity set plus the discriminator of
the weak entity set forms the primary key of a weak entity set.
{loan no., payment no.} is the primary key of weak entity set
payment where loan no. is the primary key of the identifying entity
set loan
The identifying relationship set should have no descriptive
attributes, since any required attributes can be associated with the
weak entity set.
For each entity set and relationship set there is a unique table
which is assigned the name of the corresponding entity set or
relationship set.
Example:
loan: loan-number, amount
customer: customer-id, customer-name, customer-street,
customer-city
Tabular Representation of Weak Entity Sets
Example:
payment: loan-number, payment-number, payment-date, payment-
amount
Tabular Representation of Relationship Sets
Example:
Entity set loan: loan-number, amount
Entity set customer: customer-id, customer-name, customer-
street, customer-city
Relationship set borrower: customer-id, loan-no
Redundancy of Tables
2. The primary key of a weak entity set includes the primary key of
strong entity set.
Example:
Combination of Tables
If there are two entity sets A and B and there exist relationship set
R between them, 3 tables A, B, R can be generated using table
construction scheme.
For all the above cases there should be total participation of the
entity sets in the relationship set. Combination of tables works
nicely in case of total participation. If there exists partial
participation and we combine the tables there will be null values for
some entities those do not participate in relationship.
Composite Attributes
1. Specialization
2. Generalization
3. Attribute Inheritance
4. Aggregation
Higher and lower level entity set or Super class and subclass
Generalization