开发者

How to set a relation cardinality of one to one in mysql?

开发者 https://www.devze.com 2023-04-04 02:50 出处:网络
i need help with this one to one relation that i need to do in my mysql database. I try to find the answer in the stackoverflow questions but i cant find it.

i need help with this one to one relation that i need to do in my mysql database. I try to find the answer in the stackoverflow questions but i cant find it. I have a table contact and a table address, the table contact has 4 address id's so this id's must be 4 fo开发者_JAVA百科reign keys to the address table and in the address table, i need to have a contact foreign key. I'ts this correct? This would give me a (contact)1:*(address) relation?

How can i make this relation?


You have a many-to-many relationship here. You need to resolve this by introducing a new bridge table, ContactAddressXref, that contains foreign keys to both the Contact and Address tables.

0

精彩评论

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