可能的重复:
是否有适用于世界所有地址的通用街道地址数据库设计?
在数据库中存储国际地址的“最佳”方式是什么?
数据库中一致且全面的地址存储的最佳实践
我目前有四个表,客户、联系人、设施和客户。
这些表中的每一个都有以下字段:AddressLine1、AddressLine2、City、StateOrProvince、PostalCode。
我想将地址移到单独的表格中,并且还可以指定地址的类型(账单、运输、主要等)。
我的解决方案如下:
- 从客户、联系人、设施和客户中删除 AddressLine1、AddressLine2、City、StateOrProvince、PostalCode。
- 创建包含字段 AddressID(PK)、AddressLine1、AddressLine2、City、StateOrProvince、PostalCode、LastUpdateUser、LastUpdateTime 的 Addresses 表。
- 创建包含 AddressTypeID、AddressTypeName、AddressTypeDescription、AddressTypeActive、LastUpdateUser、LastUpdateTime 字段的 AddressTypes 表
- 使用字段 CustomerID、AddressID、AddressTypeID、CustomerAddressActive、LastUpdateUser、LastUpdateTime 创建 CustomerAddresses 表
- 创建包含字段 ClientID、AddressID、AddressTypeID、ClientAddressActive、LastUpdateUser、LastUpdateTime 的 ClientAddresses 表
- 创建包含字段 ContactID、AddressID、AddressTypeID、ContactAddressActive、LastUpdateUser、LastUpdateTime 的 ContactAddresses 表
- 使用字段 FacilityID、AddressID、AddressTypeID、FacilityAddressActive、LastUpdateUser、LastUpdateTime 创建 FacilityAddresses 表
我正在寻找指导以确定是否有比我设计的解决方案更好的解决方案。为什么大家都这么想?
编辑:此时我不关心美国以外的任何事情,也不关心如何存储街道地址,即街道号码与整个街道地址。我从数据库设计和表结构的角度来看。