In the Entity-Relationship model, where data is represented abstractly and conceptually in software engineering, associative entities are a part of the model. Relational models are usually made to represent data in a database or system, where they are used to organize the data into an understandable and readable schema. Entities in a relational model can represent anything, including people, places, objects, events, or concepts. Associative entities are connections that describe a relationship between two different entities. These entities can have many-to-many relationships, which means that one of the associative entities can have multiple relationships and connections to a parent or child entity.
man holding computer
Associative entities transmit information about their attributes and their connections. They are considered an entity because they have attributes and they are considered a relationship because they link entities. These types of entities often have many relationships and connections because they are assignable, but they can have meaning independent of other entities. It is also good practice in a relational model that the associative entity has at least one attribute that is distinguishable from the identifying entity. Associative entities can also be participants in relationships separate from associated entity relationships.
Primary keys must also be part of associative entities, because they are identifiers that unite certain tables in a relational model. Although tables can only contain one, primary keys are combinations of columns that uniquely specify rows. There is a difference between unique keys and primary keys in that primary keys can impose a “non-null” constraint on a table or entity. Another aspect that differentiates primary keys from unique keys is that primary keys are selected as a key of major or first importance. Primary indexes are created for the management of primary keys and for ease of use and application by a database manager.
Associative entities are contained and used by join tables – tables in a relational model that contain common fields from two or more other tables. Join tables are employed because they can handle many-to-many relationships in a specific database. An example of a database that employs the associative entity through the use of a join table is enrolling students in a course. In this case, a table with data about students is indirectly connected to a table with data about courses through an intermediate table that contains data associated with student and course data from the connection tables.