如何确保两个外键相等?

时间:2015-11-27 13:51:32

标签: mysql database foreign-keys primary-key

我有两张桌子:

script:
 - idScript (Primary Key)
 - idEnvironment (foreign key)

UAA:
 - idUser (Primary Key)
 - idEnvironment (Primary key)
 - idPaper (Primary Key)

所以,我之间有一个mxn关系,得到这个表:

UAAwithScript:
 - idUser (Primary Key)
 - idEnvironment (Primary Key)
 - idPaper (Primary Key)
 - idScript (Primary Key)

如何确保脚本和UAA中的idEnvironment相同?提供它的最佳方式是什么?

0 个答案:

没有答案