[英]Joining 2 tables which have the same foreign key from same table but one is a one to many
[英]In which table will be foreign key if the relation in two tables is many to one i.e. from 1st table (many ) to second table(one)
如果兩個表中的關系是多對一的,即從第一個表(許多)到第二個表(一個),則在哪個表中將是外鍵。
第一張桌子。 我贏什么??!
外鍵將在第一個表中,即您的多表中。
外鍵在引用其他表的表中,因此在您的情況下,它將在“許多”表中。 不要被基數所欺騙-可以以1:1關系定義外鍵。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.