开发者

In a data base how can reduce the redundency?

I have one table

Table 
Email_Address
Name
contact_No
city
Pincode
state
country

I divided into two parts

Table1
Email_Address(PK)
Name
contact_No
city

table2    
city
Pincode
sta开发者_运维问答te
country

how i can maintain the relationship between this table.


City would be the primary key of table2 and a foreign key in Table1. (But that requires city names to be globally unique and have only a single pincode each).

You need to be sure that a single city has only one Pincode. If that is not the case, probably use the Pincode as primary/foreign key instead of city.

Update: Since apparently there are cases where some pincodes span multiple cities, you probably need to live with the redundancy or introduce an artificial key. Also see the links to similar questions here in the comments.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜