Composite Entity Example –
As earlier said in previous post (entity and its types), Composite Entities are the entities which exists as a relationship as well as an entity.
Consider the three types of connectivity –
- one to one cardinality
- one to many cardinality
- many to many cardinality
A many to many relationship does not exist during finalizing ERD (ER Diagram) as many to many relationship will cause problems to ERD in converting into Relational model.
So, elimination of many to many relationship is necessary and is done by including the composite entities in ER Diagram.
Composite Entity Example :
Consider the above example, EMPLOYEE and PROJECT is many to many relationship. because each employee could be involved in a number of different projects and a number of employees could be working in a given project.
So, the relationship notation will be replaced by the composite entity notation, which is shown as –
Changes in the Above Diagram are:
1) Relationship symbol is converted into composite entity symbol. The composite entity is represented by combining the relationship symbol (diamond) with the entity symbol (rectangle). 2) Entity names are usually described with a noun name(objects-employee and projects) and relationship are usually described with a verb (involve). Since the composite entity is the combination of an entity and a relationship, the name of the many-to-many relationship should be changed(involvement). 3) Redo the relationship connectivity- the employee and the project are no longer directly related to each other. The new relationship is now between the employee and involvement, and the project and involvement. So reconsidering the connectivities among the new entities- ⇒ each employee has involvement in many projects(one-to-many relationship) and ⇒ in each project, there is involvement of many employees(many-to-one relationship).
Key of the Composite Entity –
The key of the composite Entity is the combination of other two table’s key. In the above example, if the key of the EMPLOYEE entity is empID and the key of the PROJECT entity is PID then the key of the composite entity INVOLVEMENT will be the combination of (empID, PID).
In case of composite entity, the key will always be a composite key i.e. the combination of the other two table’s keys.
Attribute of the Composite Entity –
We can give extra attributes to the composite entity. in the above example, involve_date will be the extra attribute given to the composite key.
|Entity and its Types||Supertype and Subtype|
Incoming search terms:
- Composite Entity
- composite entity example
- what is a composite entity
- what is composite entity
- composite entity diagram
- composite entities in database
- Representation of a composite entity in an ERD
- example of entity cardinalities
- entity examples in sql
- define composite entity in databases