开发者

foreign key doubt in MYSQL

开发者 https://www.devze.com 2023-01-20 01:42 出处:网络
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)

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

精彩评论

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

关注公众号