Menu

Inferring Many-to-Many Link Tables
📰

Inferring Many-to-Many Link Tables

DEV Community: database·Jeff·3 days ago
#6P1P0dqH
#devtodatabase#devto#dev#table#foreign
Reading 0:00
15s threshold

Quick answer: When two schemas reference each other in a way that implies a repeated relationship, the modeling layer infers a many-to-many link table that holds the two foreign keys. It stays in the Inferred layer rather than being treated as a confirmed table, and when the cardinality is ambiguous it raises an open question instead of guessing.

Why a link table is needed

A one-to-many relationship fits naturally on one side, with a foreign key pointing back. A many-to-many relationship does not, because each side can relate to many rows on the other, and forcing the relationship into either table would require storing a list of keys rather than a clean relational design.

A link table resolves that.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.