Entity in DBMS
An entity in DBMS (Database management System) is a real-world thing or a real-world object which is distinguishable from other objects in the real world. For example, a car is an entity. An attribute of an entity gives us information about the characteristic features of an entity. For example, a black car entity has an attribute called color which has a value black.
Scope of article
- This article defines what entities are and how important they are in the domain of Database and Management System. We will also discuss different types of entities that are there and we will also discuss how they are represented in the entity-relationship diagram. We will also discuss what entity sets are and how they are different from entities.
- Each topic in this article will be discussed with the help of some real-life examples that will help the reader to clearly understand each of the concepts given in the article.
An entity in DBMS (Database Management System) is a real-world object that has certain properties called attributes that define the nature of the entity. Entities are distinguishable, i.e., each entity in a pair of entities has a property that makes one entity different from the other entity. For example, if we consider a black piece entity on a chessboard and a white piece on a chessboard, they are distinguishable since the color of the black piece and the white piece are distinguishable. Entities consist of attributes that define their characteristic features/properties.
If we consider a car entity, it can have its attributes as a car's registration number, car's model, car's name, car's color, number of seats that are there inside the car, etc. Below is the tabular representation of the car entities.
In this table, each row represents an entity. Among the attributes present in the above table, there are some attributes that can uniquely represent a row/entity in the given table. It means that all the elements in the table have a distinct value for this particular attribute. This attribute is called the primary attribute and primary key.
For Example: In the car entity, the attribute registration number can be taken as the primary key since the registration number can never be the same for two different cars.
Entities are divided into two categories. These two categories of an entity are tangible entities and non-tangible entities.
- Tangible Entities Tangible entities are the entities that physically exist in the real world. For example, the entity of cars, the entity of books, etc.
- Non-Tangible Entities Nontangible entities are entities that do not physically exist in the real world. For example, entity of email id's, an entity of social media accounts, etc.
An entity set in DBMS is a set that collectively represents a group of entities of a similar type.
For Example: An entity set of cars, an entity set of bank accounts, etc. In DBMS, the whole table in the tabular representation of data is an entity set, while each row inside this table is an entity. Below is the tabular representation, i.e., entity set of bank accounts.
In entity-relationship diagrams, entity sets are represented by a rectangle, and the attributes of an entity set are represented by an ellipse.
Below is the representation of the bank entity accounts set in an entity-relationship diagram.
Weak Entity Set
Weak entity set in DBMS is an entity set that does not have a primary key, i.e., there exists no attribute that can uniquely represent each entity in the entity set.
For Example: An entity set of cars having attributes such as a car's color, a car's name is a weak entity since two cars can have the same color as well as the same name. So, none of the attributes can be considered as the primary key and hence the entity set is a weak entity set.
In entity-relationship diagrams, weak entity sets are represented by a double rectangle.
Strong Entity Set
**Strong entity set in DBMS is the entity set in which there exists a primary key, i.e., there exists an attribute that can uniquely represent each element in the entity.
** For Example:**, An entity set of cars having attributes such as a car's registration number, car's color, car's name is a strong entity since no two cars can have the same registration number. So, the attributes registration number can be considered as the primary key, and hence the entity set is a strong entity set.
In entity-relationship diagrams, strong entities are represented by a rectangle.
Difference between an Entity and an Entity Set
- An entity in DBMS is used to represent any real-world object, while an entity set in DBMS is a set or collection of entities of similar types.
- In relational models, i.e., the tabular representation to represent data, each row in a table is a separate entity while the whole table is an entity set.
- We cannot represent an entity in an entity-relationship diagram (ER diagram) while entity sets are represented using a rectangle in an entity-relationship diagram (ER diagram).
- An entity contains the actual data, while an entity set contains the blueprint of an entity.
- In this article, all the important concepts required to understand the concept of entity in Database Management System are discussed along with the relevant examples.
- The difference between an entity and an entity set is discussed in this article.
- Different types of entity sets, such as weak entity sets and strong entity sets are also discussed in this article.