简体   繁体   English

3个级别与结果表之间的关系

[英]Relations between 3 levels and a result table

I have 3 tables that work, let's say, as levels for this purpose. 可以说,我有3个tables可以用作为此目的的级别。 Everyone of them has 2 columns, id and name . 每个人都有2列, idname And, they combined, result on posibilities that matches the table 4 . 并且,他们合并得出的结果与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? 如何在合并后的第一组( 3 tables )和最后一个之间创建可能的结果之间的关系?

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. 我过去只用2 tables ,然后我创建了第三个2 tables ,其中有2个字段, FKs对于原始表有2个FKs But this time, I have a set of 3 tables to match with a fourth, and that's what's making me wonder. 但是这一次,我有一组3 tables与第四tables相匹配,这让我感到奇怪。

Should I simply create a 5th table with 4 fields having 4 FKs or is there another way? 我应该简单地创建一个包含4个具有4个FKs字段的第5个表,还是有其他方法吗?

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. 注意,第5个表将有3个FK列链接到其他3个表,第4个是行ID。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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