Difference between entity, entity set and entity type - GeeksforGeeks (2024)

Improve

Improve

Improve

Like Article

Like

Save Article

Save

Report issue

Report

The ER model is a very important concept in DBMS, and it is used for the modeling of the logical view of the system from a data perspective. The entity, Entity Set, and Entity Type all these terms are very important concepts of ER Model. In this article, we will understand the difference between them.

1. Entity : An entity is a thing in a real-world with independent existence. An entity can exist independently and is distinguishable from other objects. It can be identified uniquely.

An entity can be of two types :

  • Tangible Entity : Entities that exist in the real world physically. Example: Person, car, etc.
  • Intangible Entity : Entities that exist only logically and have no physical existence. Example: Bank Account, etc.

Example :

  • A student with a particular roll number is an entity.
  • A company with a particular registration number is an entity.

Note :

  • An entity may be concrete like a student, a book, or abstract like a holiday or a particular concept.
  • An entity is represented by a set of attributes.
  • In a particular relation in RDBMS, a particular record is called an entity.

2. Entity Type : It refers to the category that a particular entity belongs to.

Difference between entity, entity set and entity type - GeeksforGeeks (1)

Example :

  • A table named student in a university database.
  • A table named employee in a company database.

Note :

  • The category of a particular entity in the relation in RDBMS is called the entity type.
  • It is represented by the name of the table and its schema.

3. Entity Set : An entity set is a collection or set of all entities of a particular entity type at any point in time. The type of all the entities should be the same.

Difference between entity, entity set and entity type - GeeksforGeeks (2)

Example :

  • The collection of all the students from the student table at a particular instant of time is an example of an entity set.
  • The collection of all the employees from the employee table at a particular instant of time is an example of an entity set.

Note :

  • Entity sets need not be disjoint. For example, the entity set of Article Writer (all content creators for GeeksforGeeks) and the entity set of Article Reader (all students who read the article of GeeksforGeeks) may have members in common.
  • The collection of all the entities in the relation of RDBMS is called an entity set.

Relation With Table :

Consider a table student as follows :

Table Name : Student

Student_IDStudent_NameStudent_AgeStudent_Gender
1Avi19M
2Ayush23M
3Nikhil21M
4Riya16F

Entity : Each row is an entity.

Example :

1Avi19M

Entity Type : Each entity belongs to the student type. Hence, the type of entity here is a student.

Entity Set : The complete data set of all entities is called entity set. For the above table, the records with student id 1, 2, 3, 4 are the entity set.

Difference Table :

EntityEntity TypeEntity Set
A thing in the real world with independent existenceA category of a particular entitySet of all entities of a particular entity type.
Any particular row (a record) in a relation(table) is known as an entity.The name of a relation (table) in RDBMS is an entity typeAll rows of a relation (table) in RDBMS is entity set

Last Updated : 24 Nov, 2021

Like Article

Save Article

Share your thoughts in the comments

Please Login to comment...

Difference between entity, entity set and entity type - GeeksforGeeks (2024)
Top Articles
Latest Posts
Article information

Author: Velia Krajcik

Last Updated:

Views: 5778

Rating: 4.3 / 5 (54 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Velia Krajcik

Birthday: 1996-07-27

Address: 520 Balistreri Mount, South Armand, OR 60528

Phone: +466880739437

Job: Future Retail Associate

Hobby: Polo, Scouting, Worldbuilding, Cosplaying, Photography, Rowing, Nordic skating

Introduction: My name is Velia Krajcik, I am a handsome, clean, lucky, gleaming, magnificent, proud, glorious person who loves writing and wants to share my knowledge and understanding with you.