Professional Documents
Culture Documents
Unit – 2
Data Modelling Using Entity- Relationship Model
This is a first step during this step, the database designer’s interview
prospective database users to understand and document their data
requirements.
The result of this step is a collected written set of users’ requirements.
Unit-III, Data Modelling using the Entity-Relationship model
b. Conceptual Schema:
c. Logical Design
d. Physical Design
Entity
An entity is a real-world thing which can be distinctly identified like a person, place or a
concept. It is an object which is distinguishable from others.
An entity can be of two types:
Tangible Entity: Tangible Entities are those entities which exist in the real world
physically. Example: Person, car, etc.
Intangible Entity: Intangible Entities are those entities which exist only logically and
have no physical existence. Example: Bank Account, etc.
Entity Type
The entity type is a collection of the entity having similar attributes.
Example:
Unit-III, Data Modelling using the Entity-Relationship model
1. Strong Entity Type: Strong entity are those entity types which has a key attribute.
The primary key helps in identifying each entity uniquely. It is represented by a
rectangle. In the above example, Roll_no identifies each element of the table
uniquely and hence, we can say that STUDENT is a strong entity type.
2. Weak Entity Type: Weak entity type doesn't have a key attribute. Weak entity
type can't be identified on its own. It depends upon some other strong entity for its
distinct identity. This can be understood with a real-life example. There can be
children only if the parent exits. There can be no independent existence of
children.
Unit-III, Data Modelling using the Entity-Relationship model
Entity Set
Attribute
Simple Attributes
Simple attributes in an ER model diagram are independent attributes that can't be
classified further and also, can't be sub-divided into any other component. These attributes
are also known as atomic attributes.
Unit-III, Data Modelling using the Entity-Relationship model
Composite Attributes
Single valued attributes are those attributes that consist of a single value for each entity
instance and can't store more than one value. The value of these single-valued attributes
always remains the same just like the name of a person.
Unit-III, Data Modelling using the Entity-Relationship model
Multi-Valued Attributes
As we can see in the above example, the Student entity has four attributes: Roll_no and Age
are simple as well as single-valued attributes as discussed above
but Mob_no and Email_id represented by co-centric ellipse are multi-valued
attributes. Each student in the real world can provide more than one email-id as well as a
mobile contact number and therefore, we need these attributes to be multi-valued so that
they can store multiple values at a time for an entity instance.
Derived Attributes
Derived attributes are those attributes whose values can be derived from the values of
other attributes. They are always dependent upon other attributes for their value.
For example, As we were discussing above, DOB is a single-valued attribute and remains
constant for an entity instance. From DOB, we can derive the Age attribute which changes
every year, and can easily calculate the age of a person from his/her date of birth value.
Hence, the Age attribute here is derived attribute from DOB single-valued attribute.
Unit-III, Data Modelling using the Entity-Relationship model
Complex attributes are rarely used in DBMS. They are formed by the combination of multi-
valued and composite attributes. These attributes always have many sub-sections in their
values
As we can see in the above example, Address_EmPhone (which represents Address, Email,
and Phone number all together) is a complex attribute. Email and Phone number are
multi-valued attributes while Address is a composite attribute which is further sub-divided
as House number, Street, City & State. This combination of multi-valued and composite
attributes altogether forms a complex attribute.
Key Attributes
Key attributes are special types of attributes that act as the primary key for an entity and
they can uniquely identify an entity from an entity set. The values that key attributes store
must be unique and non-repeating
As we can see in the above example, we can say that the Roll_no attribute of the Student
entity is not only simple and single-valued attribute but also, a key valued attribute as
Unit-III, Data Modelling using the Entity-Relationship model
well. Roll_no of a student will always be unique to identify the student. Also note that
the Gender and Age of two or more persons can be same and overlapping in nature and
obviously, we can't identify a student on the basis of them. Hence, gender and age are not
key-valued attributes.
. Stored Attribute
Values of stored attributes remain constant and fixed for an entity instance and also, they
help in deriving the derived attributes. For example, Age attribute can be derived
from Date of Birth attribute, and also, Date of birth attribute has fixed and constant value
throughout the life of an entity. Hence, Date of Birth attribute is a stored attribute.
Super Key – A super key is a group of single or multiple keys which identifies rows
in a table.
Primary Key – is a column or group of columns in a table that uniquely identify
every row in that table.
Candidate Key – is a set of attributes that uniquely identify tuples in a table.
Candidate Key is a super key with no repeated attributes.
Alternate Key – is a column or group of columns in a table that uniquely identify
every row in that table.
Foreign Key – is a column that creates a relationship between two tables. The
purpose of Foreign keys is to maintain data integrity and allow navigation between
two different instances of an entity.
Compound Key – has two or more attributes that allow you to uniquely recognize a
specific record. It is possible that each column may not be unique by itself within the
database.
Unit-III, Data Modelling using the Entity-Relationship model
ONE-TO-ONE(1:1):
1. ONE-TO-MANY:
The following image reflects that only one instance of the entity on
the right and more than one instance of an entity on the left can be
associated with the relationship.
It depicts one-to-many relationship.
2. MANY-TO-ONE:
Many-To-Many:
An entity of entity set is associated with two or more entities of
entity.
For example: a doctor has many patients to diagnose on disease.
It depicts many-to-many relationship.
Unit-III, Data Modelling using the Entity-Relationship model
Participation Constraints
Total Participation
Each entity is involved in the relationship. Total participation is
represented by double lines.
Partial participation
Not all entities are involved in the relationship. Partial
participation is represented by single lines.
ER- Model
Notations Of ER-Diagram
Unit-III, Data Modelling using the Entity-Relationship model
Examples on ER Diagram
Unit-III, Data Modelling using the Entity-Relationship model
RELATIONSHIP
It Means