Intermediate table to store a relationship where more than one row of T1 refers to more than one row of T2.

Study for the SQL Basics Test. Improve your knowledge with multiple choice questions and detailed explanations. Prepare effectively to master SQL concepts!

Multiple Choice

Intermediate table to store a relationship where more than one row of T1 refers to more than one row of T2.

Explanation:
In relational databases, a many-to-many relationship between two tables is modeled with an intermediate structure that links individual rows from each side. This is what a junction table does: it stores pairs of references, one to a row in the first table and one to a row in the second table, so that each association is captured as its own row. You create two foreign keys in this table, one pointing to T1 and the other to T2. Those two columns (often together as a composite primary key) ensure each pair is unique. This design lets more than one row in T1 relate to many rows in T2, and vice versa, without cluttering either table with multiple references. For example, if T1 is Authors and T2 is Books, a junction table like AuthorBook could hold author_id and book_id, recording which authors contributed to which books. An author can have multiple books and a book can have multiple authors, all represented cleanly as separate rows. Bridge or link tables are terms you might hear in some contexts, but the standard, explicit concept for this structure is a junction table. It exactly describes the role of storing the cross-relationships between the two tables.

In relational databases, a many-to-many relationship between two tables is modeled with an intermediate structure that links individual rows from each side. This is what a junction table does: it stores pairs of references, one to a row in the first table and one to a row in the second table, so that each association is captured as its own row.

You create two foreign keys in this table, one pointing to T1 and the other to T2. Those two columns (often together as a composite primary key) ensure each pair is unique. This design lets more than one row in T1 relate to many rows in T2, and vice versa, without cluttering either table with multiple references.

For example, if T1 is Authors and T2 is Books, a junction table like AuthorBook could hold author_id and book_id, recording which authors contributed to which books. An author can have multiple books and a book can have multiple authors, all represented cleanly as separate rows.

Bridge or link tables are terms you might hear in some contexts, but the standard, explicit concept for this structure is a junction table. It exactly describes the role of storing the cross-relationships between the two tables.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy