简体   繁体   中英

Relations between 3 levels and a result table

I have 3 tables that work, let's say, as levels for this purpose. Everyone of them has 2 columns, id and name . And, they combined, result on posibilities that matches the table 4 .

How can I create the relationships between the first set ( 3 tables ), and the last one with the possible results after the combination?

I did this in the past just with 2 tables , back then I created a third one having 2 fields, 2 FKs against the original tables. But this time, I have a set of 3 tables to match with a fourth, and that's what's making me wonder.

Should I simply create a 5th table with 4 fields having 4 FKs or is there another way?

Use a 5th table as an assignment table, then using a nested query with joins you can access the data in your results table

note, the 5th table would have 3 FK columns linked to the 3 other tables, and a 4th for a row id.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM