Difference between entity, entity set and entity type
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.
- A student with a particular roll number is an entity.
- A company with a particular registration number is an entity.
- 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.
- A table named student in a university database.
- A table named employee in a company database.
- 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.
- 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.
- 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_ID Student_Name Student_Age Student_Gender 1 Avi 19 M 2 Ayush 23 M 3 Nikhil 21 M 4 Riya 16 F
Entity : Each row is an entity.
1 Avi 19 M
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 :
Entity Entity Type Entity Set A thing in the real world with independent existence A category of a particular entity Set 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 type All rows of a relation (table) in RDBMS is entity set
Attention reader! Don’t stop learning now. Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.
Learn all GATE CS concepts with Free Live Classes on our youtube channel.