Junction table

A junction (or association) table implements a many-to-many relationship between two tables: it contains the foreign keys from both sides, often as a composite primary key, and possibly attributes of the relationship. To query it, you join the three tables.

Example

CREATE TABLE inscriptions (
  etudiant_id int, cours_id int,
  PRIMARY KEY (etudiant_id, cours_id));

Related concepts

The whole glossary