开发者

foreign key doubt in MYSQL

can we define a primary key in a table as a foreign key in that table . I mean,

PRIMARY KEY(ssn),
 FOREIGN KEY (ssn) R开发者_如何转开发EFERENCES Cust(cust_ssn)

And If we have a table that has some parameters that refers to some other table parameters and to some other 3rd table too. Then Do we need to define those parameters as foreign key referencing to both the tables or Just only one.


Yes. Any field or combination of fields can be a foreign key.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜