Stephen Forlance
asked on
What is this type of table called?
Hi all,
Having a lockdown brain moment, whats the type of table called that defines the relationship between records in two other tables?
For example:
if I have two tables:
projects
users
its a many to main relationship, so I would have a table called project_users, which would be:
id
project_id
user_id
which would define which users belonged to which projects
Also, is there a standard way to denote these types of tables, since they are defining relationships, not actually data?
Having a lockdown brain moment, whats the type of table called that defines the relationship between records in two other tables?
For example:
if I have two tables:
projects
users
its a many to main relationship, so I would have a table called project_users, which would be:
id
project_id
user_id
which would define which users belonged to which projects
Also, is there a standard way to denote these types of tables, since they are defining relationships, not actually data?
The term you're looking for is "link table" or "associative entity":
https://en.wikipedia.org/wiki/Associative_entity
https://en.wikipedia.org/wiki/Database_normalization#Satisfying_1NF
https://en.wikipedia.org/wiki/Associative_entity
https://en.wikipedia.org/wiki/Database_normalization#Satisfying_1NF
Juntion Table
Join Table
etc.
Different names for the same thing :)
Join Table
etc.
Different names for the same thing :)
As it stands, linking, junction, join, etc as has been said.
But if you start to add attributes (fields) that describe something about the relationship itself, then it's no longer a linking table per say.
But don't get hung up on the naming....important thing is to get the design right<g>
Jim.
But if you start to add attributes (fields) that describe something about the relationship itself, then it's no longer a linking table per say.
But don't get hung up on the naming....important thing is to get the design right<g>
Jim.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Just a couple of notes on "joining" tables.
I wouldn't bother including an id column, instead using the combined foreign key references as the primary key. I would also recommend adding a defaulted CreatedDate column; it will come in handy later for trouble-shooting.
I wouldn't bother including an id column, instead using the combined foreign key references as the primary key. I would also recommend adding a defaulted CreatedDate column; it will come in handy later for trouble-shooting.
though a relationship table does not need an id column as it conveys no information.
it, this tables row id, will not be used as a reference anywhere else..
it, this tables row id, will not be used as a reference anywhere else..
Me viewing the accepted solution...
Btw, where are those face-palm emojis here?!?
https://en.wikipedia.org/wiki/Many-to-many_(data_model)