The reason for having a database is to store data values about entities, and then to retrieve the data values regarding those entities as needed. In order to accomplish this, there must be some way to distinguish one entity from another.
Entity identifiers perform this function. Entity identifiers are attributes, specifically, key attributes that uniquely identify each entity. An entity identifier is not an optional attribute; every entity must have a key attribute to uniquely identify it. Entity identifiers (key attributes) become primary keys in a table.
A composite entity is also known as a bridge entity. This bridge is used to handle the many-to-many relationships that the traditional entity could not handle.
This entity lies between the two entities that are of interest and this composite entity shares the primary keys from both the connecting tables. This composite entity is also known as a gerund because it has the characteristics of an entity and a relationship.
You will learn about a composite entity later in the course. The composite entity exists only to link two other entities together. A composite entity has no entity identifier of its own.
Instead, it receives the entity identifiers from each of the two entities it serves to link, and combines them to form a composite entity identifier (usually called a composite key attribute).
In data modeling, a composite entity is an entity that is created to represent a many-to-many relationship between two or more entities in a database. It is also known as a
associative entity, or
In a many-to-many relationship, one instance of an entity can be related to multiple instances of another entity, and vice versa. For example, in a database for a university, a many-to-many relationship exists between students and courses, as a student can enroll in multiple courses, and a course can have multiple students enrolled in it.
To represent this many-to-many relationship, a composite entity can be created. The composite entity has its own attributes and primary key, and it serves as a connector between the two entities it relates. In the case of the student and course entities, a composite entity called "enrollment" could be created, which would have attributes such as "semester," "grade," and "attendance."
The enrollment entity would have foreign keys that reference the primary keys of the student and course entities, allowing it to establish a many-to-many relationship between them. In this way, the enrollment entity acts as a bridge or junction between the student and course entities, allowing them to be connected in a meaningful way.
Composite entities are important in data modeling because they allow for complex relationships between entities to be represented in a structured and organized way. By breaking down many-to-many relationships into smaller, more manageable relationships, composite entities can help make a database more efficient and easier to understand.
Entity Identifier Attribute
An entity is something about which we store data. For example, a customer is an entity, as is a merchandise item stocked by Distributed Networks.
Entities are not necessarily tangible. For example, a concert is an entity.
Entities have data that describe them (their attributes).
For example, a customer entity is usually described by a
zip code, and
A concert entity might be described using the following attributes: 1) title, 2) date, 3) location, and 4) name of the performer.
When we represent entities in a database, we actually store only the attributes. Each group of attributes that describes a single real-world occurrence of an entity acts to represent an instance of an entity.
For example, in Figure 5-3, you can see three instances of a customer entity stored in a database. If we have 1000 customers in our database, there will be 1000 collections of customer attributes.
The next lesson lists two rules for creating entity identifiers.