Entity-Relationship Model : Entity, Entity-Sets and Entity Types

Entity :  An entity is a “thing” or “object” in the real world that is distinguishable from all other objects. For example, each person in an enterprise is an entity. An entity has a set of properties, and the values for some set of properties may uniquely identify an entity. For example, in a school database, students, teachers, classes, and courses offered can be considered as entities. All these entities have some attributes or properties that give them their identity. 

Entity Set: An entity set is a set of entities of the same type that share the same properties, or attributes. For example, a Students set may contain all the students of a school; likewise a Teachers set may contain all the teachers of a school from all faculties. Entity sets need not be disjoint.

Types of Entity :

1. Strong Entity :  Entities having its own attribute as primary keys are called strong entity. For example, STUDENT has STUDENT_ID as primary key. Hence it is a strong entity.

2. Weak entity : Entities which cannot form their own attribute as primary key are known weak entities. These entities will derive their primary keys from the combination of its attribute and primary key from its mapping entity. For example consider Department and Class entity. The Class has Class_id and Class_name as its attribute. But Class_id alone cannot be a primary key, since it fails to tell for which course it is related to. But if this attribute along with Depart_id is included then we can uniquely identify the Class.

3. Composite Entities : Entities participating in the many to many relationships are called composite entity. Composite Entities are also called Bridge Entities, because they acts like a bridge between the two entities which have many to many relationship.

4. Recursive Entity: If a relation exists between the same entities, then such entities are called as recursive entity. It is an entity type with foreign key referencing to same table or itself. Let us take the example of an employee who is also a manager. But a manager is also an employee, whose details will be held in the employee entity. To implement this a foreign key of the employee's manager number would be held in each employee record. 

No comments:

Post a Comment