How connect Two tables that connect the information about Address?
I have One table ,reduce the redunduncy i devided into two parts Table Email Address(PK) Name city state Pincode Country Land_Line_No D_O_B Gender Marital_Status
After Devided
Table1 Name开发者_JAVA技巧 city Land_Line_No D_O_B Gender Marital_Status
Table2 city state Pincode Country
My question is how to connect this two table
An attribute in the second table would be same as the primary key in the first table. These attributes are commonly known as foreign key.
On another issue however, what have you reduced? You have city in both the tables which looks redundant. Perhaps I am not clear as to what you want.
Schema should look more like this:
Table1 Name municipalityID Land_Line_No D_O_B Gender Marital_Status
Table2 municipalityID city state Pincode Country
Now the municipalityID
field in Table2 should be unique on each line thus making it the primary key of the table. In order to associate any record form Table with a specific city, etc.. you would reference the proper municipalityID
(this is a foreign key in Table1 referencing Table2).
精彩评论