In DBMS (Database Management System), an entity is something that can be uniquely identified and stored in a database. It typically represents a real-world object or concept that has a distinct existence and attributes.
An entity is an object in the real world that is distinguishable from other objects. In the context of a database, it is usually represented by a table, and each row in the table represents an instance (or occurrence) of that entity.
An Entity in DBMS (Database Management System) is a real-world object, person, place, thing, or concept about which data is stored in a database.
In simple words, an entity is anything for which we want to store information.
Examples:
- Student
- Teacher
- Employee
- Customer
- Product
- Hospital
Examples of Entities:
- Student (could have attributes like student_id, name, age, course)
- Employee (attributes: emp_id, name, department, salary)
- Product (attributes: product_id, name, price, quantity)
- Book, Customer, Order – all can be entities.
Example of an Entity
Suppose we have a Student Database.
A Student is an entity because we store information about students.
| Student_ID | Name | Age | Course |
| 101 | Rahul | 20 | BCA |
| 102 | Aman | 21 | BBA |
| 103 | Simran | 19 | BCA |
Here:
- Student = Entity
- Student_ID = Attribute
- Rahul, Aman, Simran = Entity instances (records)
Types of Entities:
- Strong Entity:
- Exists independently.
- Has a primary key.
- Example: Employee table with emp_id as primary key.
- Weak Entity:
- Cannot exist without a related strong entity.
- Has a partial key and is dependent on a strong entity.
- Example: Dependent of an employee (depends on Employee for identification).
Entity vs. Attribute:
- Entity = object (e.g., “Car”)
- Attribute = properties of the object (e.g., “color”, “model”, “price”)
In ER (Entity-Relationship) Diagram:
- Entities are represented by rectangles.
- Attributes are shown as ellipses connected to entities.
entity diagram in dbms
Components of an ER Diagram:
- Entity:
- Represented by a rectangle.
- Example: Student, Course, Employee.
- Attribute:
- Represented by an ellipse (oval).
- Describes properties of an entity.
- Example: Student may have attributes like Student_ID, Name, Age.
- Relationship:
- Represented by a diamond shape.
- Shows how entities are related.
- Example: A Student enrolls in a Course.
- Primary Key:
- An attribute that uniquely identifies an entity instance.
- Underlined in the diagram.
- Weak Entity:
- Represented by a double rectangle.
- Depends on another (strong) entity for existence.
- Multivalued Attributes:
- Represented by a double ellipse.
- Example: Phone Numbers.
- Derived Attribute:
- Represented by a dashed ellipse.
- Example: Age derived from Date of Birth.
Example ER Diagram (Text-Based):
[STUDENT] ——–(enrolls in)——– [COURSE]
| |
(Student_ID) (Course_ID)
|
(Name)
|
(Age)
- STUDENT and COURSE are entities.
- enrolls in is a relationship.
- Student_ID and Course_ID are primary keys.
- Name and Age are attributes of STUDENT.
Key Symbols in an ER Diagram:
| Symbol | Meaning |
|---|---|
| Rectangle | Entity |
| Oval | Attribute |
| Diamond | Relationship |
| Underlined Attribute | Primary Key |
| Double Rectangle | Weak Entity |
| Double Oval | Multivalued Attribute |
Types of Entities in DBMS
There are two main types of entities:
1. Strong Entity
A strong entity is an entity that has its own primary key and can exist independently.
Example: Student, Employee, Department.
2. Weak Entity
A weak entity is an entity that cannot be uniquely identified by its own attributes alone. It depends on another entity (strong entity).
Example: A Dependent of an Employee.
What is an Entity Set?
An entity set is a collection of similar types of entities.
Example:
- Rahul (Student)
- Aman (Student)
- Simran (Student)
All these students together form a Student Entity Set.
Difference Between Entity and Attribute
| Entity | Attribute |
| A real-world object | A property of an entity |
| Example: Student | Example: Name |
| Represents an object | Describes an object |
Advantages of Entities in DBMS
- Help organize database information.
- Represent real-world objects.
- Make database design easier.
- Help identify relationships between objects.
- Help reduce data duplication through proper database design.
Remember: Entity = Object, Attribute = Property, Relationship = Connection between entities.