In the Entity-Relationship model, where data is abstractly and conceptually represented in software engineering, associative entities are one part of the model. Relational models are often made to represent data in a database or system, where they are used to organize data into an understandable and readable schema. Entities in a relational model could 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, meaning that one of the associative entities may have multiple relationships and connections to a parent or child entity.
Associative entities convey 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 together. These kinds of entities very frequently have many relationships and connections because they are attributable, but they can have independent meaning from other entities. It is also good practice in a relational model for the associative entity to have, at the very least, one attribute that is distinguishable from the identifier entity. Associative entities can also be participants in relationships separate from the associated entity relationships.
Primary keys should be a part of associative entities as well, because they are identifiers that adjoin certain tables in a relational model. Though tables may 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 enforce a “not null” constraint in a table or entity. Another aspect that differentiates primary keys from unique keys is that primary keys are selected as a key of most, or first, importance. Primary indexes are created for the management of primary keys and for ease of use and enforcement by a database manager.
Associative entities are contained in and used by junction tables — tables in a relational model that contain common fields from two or more other tables. Junction tables are employed because they can deal with many-to-many relationships in a particular database. One example of a database that employs the associative entity through the use of junction table is the enrollment of students in a course. In this case, a table with data about students is connected indirectly to a table with data about courses through an intermediate table which contains data associated with student and course data from the connecting tables.