How to set a relation cardinality of one to one in mysql?
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.
精彩评论