Entity
Entity
Definition
An entity is a real-world object or concept that can be distinctly identified and about which data is stored. It is the most basic building block of the Entity-Relationship (ER) model. An entity can be a tangible object (a person, a car, a building) or an intangible one (a course, a job title, a bank account) — the only requirement is that it is distinguishable from every other entity.
Worked Example
In our running college database scenario, a particular student — say, "Roll No. 21CS045, Aditi Sharma" — is one entity. A specific course, "Database Management Systems (CS301)," is a different entity. Each row you eventually store for a student or a course corresponds to one entity — a single, concrete occurrence.
It is important not to confuse the entity (the single occurrence, e.g., Aditi Sharma) with the entity set (the whole collection of students), which is a separate, closely related concept covered next.
Edge Cases
- An entity must have at least one attribute that lets it be distinguished from other entities of the same kind (this is formalized later as a key).
- An entity does not have to be a physical object: "CS301 - Section A" (a course offering) or "Semester 6" (an academic term) are perfectly valid entities even though you cannot touch them.
- Two entities can look similar on the surface (two students both named "Rahul Kumar") but remain distinct entities because they are different real-world occurrences, identified by different roll numbers.
- An entity by itself carries no meaning in the database until it is described by attributes and grouped into an entity set.
Key Takeaways / Interview Q&A
Q: Is "Student" an entity or an entity type? A: "Student" as a category is an entity type (or entity set). "Aditi Sharma, Roll No. 21CS045" is a specific entity — one instance of that type.
Q: Can an entity exist without any attributes? A: Conceptually no — an entity is only recognizable and identifiable because of the attributes describing it (name, ID, etc.). An entity with zero attributes cannot be distinguished from any other entity.
Q: Give a non-obvious example of an entity. A: A single "Enrollment" record — Student X enrolled in Course Y during Semester Z — is itself treated as an entity when the relationship carries its own descriptive data (like grade or enrollment date), which is one reason the ER model sometimes promotes relationships into entities.