An Entity Relationship Diagram, or ER diagram, in short, is an essential tool utilized by developers and other individuals to visually represent the relationships of different data in a database.
For drawing a proper ER diagram, one must know what exactly entities are and understand the relationships between entities you are trying to represent.
Luckily, this blog will tell you all about the entity in DBMS.
Part 1. Entity in DBMS: Brief Introduction
Let’s start with the basics. What is an Entity in DBMS (Database management System)? Well, it is basically a real-world object which exists and is easily distinguishable from other objects in the real world.
For instance, an employee is an entity. For a company database, the entities can be employees, customers, departments, etc.
In addition to that, an entity has certain properties which are known as attributes. Attributes represent the nature of each entity. This is what makes entities distinguishable because attributes define their characteristics.
For example, when considering employees as an entity, their attributes would be their Employer Identification Number, age, mobile number, gender, name, etc.
Entities can exist within two categories—tangible entities and non-tangible entities. Tangible entities physically exist in the real world and can be touched such as documents, cars, etc. Whereas non-tangible entities exist in the real world but not physically so hence, cannot be touched. For example, they are email IDs, social security numbers, phone numbers, etc.
What Are the Types of Entity in DBMS?
In a DMBS, there are two types of entity—Strong Entity and Weak Entity.
Strong Entity
A strong entity typically has a primary key and is independent—meaning they don’t rely on other entities' existence.
For example, a strong entity would be a “customer” when going through a customer database. The customer ID would be its primary key attribute since it has a unique number and cannot be replicated in the database.
Weak Entity
A weak entity, on the other hand, is dependent on the parent entity since it does not have a primary key. It basically has no meaningful attributes except for the foreign key from the parent entity.
For example, a weak entity would be an “order” in a customer database because it is solely dependent on the parent entity “customer” despite having a few attributes such as order number, deliverables, etc.
Part 2. Entity VS Entity Set VS Entity Type in DBMS
2.1 What is Entity Set in DBMS?
In DBMS, an entity set basically represents a collection of entities that are of similar type. In ER diagrams, you usually represent entity sets in a rectangle shape. An example of an entity set can be a collection of customers from the CRM for a particular period of time or a collection of all employees from the employee table around a particular timeframe. Entity sets are useful for database applicational use such as business intelligence, data mining, and utilizing its data for making important decisions.
Similar to individual entities, entity sets are also divided into two types:
- Strong Entity Set: A strong entity set exists in the DBMS without requiring another entity to exist as it has a primary key and can stand independently.
- Weak Entity Set: A weak entity set depends on another entity to exist as it does not contain a primary key.
2.2 What is Entity Type in DBMS?
As you know an Entity is a unique object you find in the real world that denotes a singular person or thing. However, an Entity Type denotes a person or object type in which the information is stored. It basically describes the type of information and how it corresponds to one or many related tables in DBMS.
2.3 A Detailed Comparison
Entity | Entity Type | Entity Set |
---|---|---|
An independent person or object that exists in the real world | A certain type or category of a specific entity | A set or group of entities that belong to a specific type |
An entity is distinguishable as it is represented by a set of attributes | An entity type is represented typically by the name of the table which consists of its data | In an entity set, all the entity's types will be the same |
In a Relation Database Management System (RDBMS), any specific row in the table is considered an entity | In an RDBMS, the name of the relation table represents the entity type | In an RDBMS, two or more rows of a relation table are considered as an entity set |
Part 3. Example of Entity in DBMS
Let’s take an example to illustrate real-world objects existing in DMBS. For this example, let us take a university database and the entities can be professors, students, etc.
Our main entity to focus on will be the Professor. The professor’s attributes (certain properties describing the entity) can be Professor ID, Name, Address, and Salary. Note that the Professor ID will be the primary key in this example.
Based on this understanding, the strong entity here will be the Professor since it has a primary key Professor ID. It will be drawn with a single rectangle. Whereas, the weak entity would be the students who are dependent on the parent entity and it will be drawn with a double rectangle.
When assembling the ER diagram, it would look like this:
Entities Assist in Building Storage of Precious Data…
Understanding entities in an ER diagram is simple and can help you map out your flowcharts effectively in DBMS. An entity in DBMS can be a real-world object which makes it distinguishable and unique.
After understanding all about entities, entity sets, and attributes, apply your learning and create your perfect ER diagrams with ease.