# Composite Entity Example

## Composite Entity Example –

#### Composite Entity-

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 –

1. one to one cardinality
2. one to many cardinality
3. 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.

### Incoming search terms:

• Composite Entity
• composite entity example
• explain composite entities in details with examples
• composite entity definition
• example of composit entity in database
• What is a composite entity and when is it used
• What is a composite entity and when is it used?
• what is composite entity