Entity
Entity
The role of the entity is the representation and management of data. In this article,
we are going to discuss entities in DBMS.
Entity:
An entity is referred to as an object or thing that exists in the real world. For example,
customer, car, pen, etc.
Entities are stored in the database, and they should be distinguishable, i.e., they
should be easily identifiable from the group. For example, a group of pens that are
from the same company cannot be identified, so they are only objects, but pens with
different colours become unique and will be called an entity like a red pen, green
pen, blue pen, black pen, etc.
In a group of pens, we can easily identify any pen because of its different colours, so
a pen of different colours is an entity.
For extracting data from the database, each data must be unique in its own way so
that it becomes easier to differentiate between them. Distinct and unique data is
known as an entity.
An entity has some attributes which depict the entity's characteristics. For example,
an entity "Student" has attributes such as "Student_roll_no", "Student_name",
"Student_subject", and "Student_marks".
Example of Entity in DBMS in tabular form:
1 Robert English 85
2 Parker Mathematics 75
3 Harry Science 80
4 George Geography 70
Some entities are related to other entities in the table. For example, the "Student"
entity is related to the "University" entity. The ERD (Entity Relationship Diagram)
model comes to light to visually show the relationship between several entities.
Kinds of Entity:
There are two kinds of entities, which are as follows:
1. Tangible Entity:
It is an entity in DBMS, which is a physical object that we can touch or see. In simple
words, an entity that has a physical existence in the real world is called a tangible
entity.
2. Intangible Entity:
For example, a bank account logically exists, but we cannot see or touch it.
Entity Type:
A collection of entities with general characteristics is known as an entity type.
For example, a database of a corporate company has entity types such as employees,
departments, etc. In DBMS, every entity type contains a set of attributes that explain
the entity.
The Employee entity type can have attributes such as name, age, address, phone
number, and salary.
The Department entity type can have attributes such as name, number, and location
in the department.
1. Strong Entity Type: It is an entity that has its own existence and is independent.
The entity relationship diagram represents a strong entity type with the help of a
single rectangle. Below is the ERD of the strong entity type:
In the above example, the "Customer" is the entity type with attributes such as ID,
Name, Gender, and Phone Number. Customer is a strong entity type as it has a
unique ID for each customer.
2. Weak Entity Type: It is an entity that does not have its own existence and relies
on a strong entity for its existence.
The Entity Relationship Diagram represents the weak entity type using double
rectangles. Below is the ERD of the weak entity type:
In the above example, "Address" is a weak entity type with attributes such as House
No., City, Location, and State.
The relationship between a strong and a weak entity type is known as an identifying
relationship.
Entity Set
An entity set is a group of entities of the same entity type.
For example, An entity of smartphones with its attributes, phone's name, phone's
colour, and phone's RAM.