What is Entity in ER Diagram: Definition and Examples
ER diagram, an entity represents a real-world object or concept that can be distinctly identified, such as a person, place, or thing. It is usually shown as a rectangle and contains attributes that describe its properties.How It Works
An entity in an ER diagram is like a noun in a sentence—it names something important that you want to keep information about. Think of it as a box that holds details about a specific thing, like a student or a car.
Each entity has attributes, which are like the characteristics or facts about that thing. For example, a "Student" entity might have attributes like "Student ID", "Name", and "Date of Birth". These attributes help describe the entity clearly.
Entities are connected to other entities through relationships, showing how things relate in the real world. This helps organize data logically for databases.
Example
This example shows a simple ER diagram with an entity called Student. It has attributes like StudentID, Name, and Age.
Entity: Student Attributes: - StudentID (Primary Key) - Name - Age
When to Use
Use entities when designing a database to represent real-world objects or concepts you want to store information about. For example, in a school database, you would create entities for Student, Teacher, and Course.
This helps organize data clearly and makes it easier to manage relationships between different pieces of information, like which students are enrolled in which courses.
Key Points
- An
entityrepresents a distinct object or concept in the real world. - Entities are shown as rectangles in ER diagrams.
- Attributes describe the properties of an entity.
- Entities connect through relationships to model data logically.