The entity relationship model is a diagrammatic representation of a database that helps the user to identify the entities present in the database and the relationship among the entities. The entity-relationship model is popularly used to design databases.
The entity-relationship model plays with the three major components that are entity, attributes and relations. In this section, we will be talking about ER model and the components of the entity-relationship model.
What is the Entity Relationship Model?
Introduction
The entity-relationship model (ER Model) was introduced by Dr Peter Chen in the year 1976. The ER model provides a graphical representation of the database that can be easily understood by humans. Consider that if we want to design a database for an enterprise then in the real-world scenario it becomes easy for the human being to identify the entities involved, characteristics of those entities and the relationship present between them.
So, we can say that the ER model will represent the logical structure of the enterprise that is being modelled. It will provide you with a preview of what entities will be there in the enterprise database, what will be the attributes of those entities, what will be the relations among those entities.
Why to use ER Model?
ER diagrams designed using the ER model can be easily translated into tables that help the database designer to build a database easily. With the help of ER diagram, you can easily implement data inside an application.
The ER diagram designed using ER model is free from any ambiguity and it provides a standard and a conceptual way to visualize the data in the database. Thus, the diagrammatical representation makes it easy to understand even by the non-technical user.
The ER model maps the activities of real-world entities onto a conceptual schema. Hence most of the database designing tools are based on the concept of ER model.
Components of ER Model
There are three basic components of every ER model that are entities, attributes and relationships. We will be discussing each component
1. Entity
An entity can be described as an object or a thing that exist in the real world and can be distinguished from other objects present in the real world. For example, an entity can be a person, a company, a car, a university, etc.
Now each entity present in the real world has a set of properties and has values for some set of properties which makes it distinguishable from other entities of the real world. Now consider a student studying in the university has a property student_id. The value of student_id i.e. 104 will uniquely identify this student from the other students studying in the university.
Now entities can be of two types as discussed below:
- Concrete Entities: Concrete entities are the ones that exist physically in the real world and can be sensed. For example, a person, student, car, etc.
- Abstract Entities: Abstract entities are the ones that exist logically in the real world and cannot be sensed. For example, a course, an online flight reservation, an account etc.
Now the entities in the real world that share the same set of properties come under the same entity set. We can define an entity set as the collection of entities sharing the same set of properties. For example, all the students of a university belong to the same entity set student.
2. Attributes
Attributes can be described as the characteristics or the properties of the entities. Each entity in the database is defined by a set of attributes. And entities belonging to the same entity set possess the same set of attributes. For example, all the entities of a student entity set will possess the same set of attributes i.e. name, course, id, address.
Now each attribute has a specific domain that defines a set of permitted values that can be assigned to that corresponding attribute. For example, the name attribute of the student entity set will accept only text strings of a certain length, the student id will accept integers and so on.
In the ER model the attributes can be represented in the following ways:
- Simple and Composite
The simple attributes are the ones that cannot be further divided into subparts for example student id. The composite attributes are the ones that can be further divided into subparts such as name {first_name, last_name}, address attribute can be divided into {street_number, street_name, appartment_name, flat_number}.
- Single-value and Multivalued
The single-valued attributes are the ones that can have only one value for a particular entity. For example, the id attribute of a student entity will have a single value and it will refer to only one student from the student entity set. So, we will refer id attribute as a single-valued attribute.
Now if we add a phone_number attribute to the student entity set a student might have no phone number, one phone number or several phone numbers. So, the phone_number attribute is a multivalued attribute.
- DerivedĀ
A derived attribute is one whose value can be derived from the value of the other attribute of the same entity. For example, we have the date_of_birth attribute in the student entity set then we can easily calculate the age of the student so here the age attribute can be referred to as a derived attribute. However, the value of the derived attribute is not stored in the database. Its value can be computed whenever required.
3. Relationships
A relationship defines an association or a relation between the entities of participating entity sets. For example, there can be a relation teaches between the entities of instructor entity set and course entity set i.e. an instructor Srinivasan teaches course computer science.
The collection of the same type of relations is referred to as a relationship set. Well, a relationship can have attributes and these are referred to as descriptive attributes. Let us consider that the teaches relation between instructor and course can have the attribute date where the value of data attribute will describe from when the particular instructor is teaching the particular course.
So, this is all about the entity-relationship model which helps in designing the database. We have studied its basic components that play a vital role in creating the ER diagrams.
Leave a Reply