您会在英国数据库中使用多少个地址字段?
地址记录可能在大多数数据库中使用,但我见过许多略有不同的字段集用于存储它们。 字段的数量似乎从 3 到 7 个不等,有时所有字段都简单标记为 address1..addressN,其他时候则给出特定含义(城镇、城市等)。
这是英国特有的,尽管我也愿意接受有关世界其他地区的评论。 在这里,您需要地址的第一行(实际上只是数字)和邮政编码来识别地址 - 其他所有内容大多是额外的好处。
我目前喜欢:
- 地址 1
- 地址 2
- 地址 3
- 城镇
- 县
- 邮政编码
如果我们需要的话,我们可以添加国家/地区(不太可能)。
你怎么认为? 这是太少了还是太多了?
Address records are probably used in most database, but I've seen a number of slightly different sets of fields used to store them. The number of fields seems to vary from 3-7, and sometimes all fields are simple labelled address1..addressN, other times given specific meaning (town, city, etc).
This is UK specific, though I'm open to comments about the rest of the world too. Here you need the first line of the address (actually just the number) and the post code to identify the address - everything else is mostly an added bonus.
I'm currently favouring:
- Address 1
- Address 2
- Address 3
- Town
- County
- Post Code
We could add Country if we ever needed it (unlikely).
What do you think? Is this too little, too much?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
邮局建议 (http://www.postoffice. co.uk/portal/po/content1?catId=19100182&mediaId=19100267) 7 行:
然后他们会说您愿意如果使用邮政城镇和邮政编码,则无需包含县名称。
The Post Office suggests (http://www.postoffice.co.uk/portal/po/content1?catId=19100182&mediaId=19100267) 7 lines:
They then say you do not need to include a County name provided the Post Town and Postcode are used.
BSI 拥有 BS 7666 - 涵盖所有寻址。 我建议你去那里看看。
2000版本建议
地址应基于包含以下实体的逻辑数据模型:
请参阅:http://landregistry.data.gov.uk/def/common/BS7666Address< /a>
The BSI have BS 7666 - that covers all addressing. I recommend you look there.
The 2000 version recommends
An address shall be based upon a logical data model comprising the following entities:
See: http://landregistry.data.gov.uk/def/common/BS7666Address
我不知道这是否是最小的(我对此表示怀疑),但我的支票簿上的标题说的是非常接近的内容:
当我尝试将其输入美国银行系统时,这会导致适合。
I don't know whether this is minimal (I doubt it) but the heading on my cheque book says something pretty close to:
This causes fits when I try to enter it into the US banking system.
如果我是您,我会致电 Royal Mail 询问他们...或在他们的网站上查找邮政编码查找作为最佳实践。
地址有不同类型,每种不同类型的结构都略有不同。 正向分拣办公室的邮政地址结构与具有街道号码的住宅不同。 如果房子有名字而不是号码怎么办? 有很多因素需要考虑。
自从我搬到加拿大后,我必须做类似的事情,它比简单的居住地址复杂得多,通常有:
那么您会得到拥有自己的送货路线的企业,邮政信箱、正向分拣办公室……
在真正匆忙的情况下,事情会变得复杂。
最好的选择 - 给皇家邮政打电话,他们应该能够为您提供有关其标准地址模板的信息。
编辑:你的 3 场方法并不是一个坏方法......尤其是。 但是,使用您拥有的字段设置,数据清理可能是一个重大问题,并且您可能需要一个相当复杂的策略来确保输入的地址有效。 清理单个专用字段以确保输入正确比从组合字段中解析各种地址标记要容易得多。
获取此信息的另一种更简单的方法是访问皇家邮政网站并检查他们的邮政编码查找页面。
在他们的主要邮政编码查找中,他们使用 4 个字段,我猜他们对街道名称/类型字段进行了某种形式的验证。 他们将门牌号和名称分开,我猜他们只允许主要城市。 我假设县/国家是假设的。 如果您进行高级搜索,他们会为您提供两个额外的字段:公寓号码和公司名称。
鉴于某些字段在其网站上组合在一起,您必须假设存在一定量的验证以确保输入的数据可以得到有效使用。
If I were you, I'd call Royal Mail and ask them... or look on their website for postcode lookup as a best practice.
There's different types of addresses, and each different type has a slightly different structure. Forward sorting offices have a different postal address structure than a residential home with a street number. What if the house has a name instead of a number? There are so many factors to consider.
Since I moved to Canada I had to do something similar and it's far more complicated than a straightforward residential address which generally has:
Then you get businesses that have their own Delivery Route, PO Boxes, Forward Sortation Offices...
It gets complicated in a real hurry.
Best bet - give Royal Mail a call and they should be able to give you information on their standard address templates.
EDIT: Your 3 field method isn't a bad one...particularly. However, data sanitization may be a significant issue using the field setup you have and you may need a fairly complex strategy for making sure that the address entered is valid. It's far easier to sanitize single dedicated fields to make sure input is correct than it is to parse various address tokens out of combined fields.
Another simpler way to gain this info is to go on the Royal Mail website and check their postcode lookup page.
On their main postcode lookup, they use 4 fields and I guess they have some form of validation on the street name/type field. They separate the house number and name and I guess they only allow major municipality. I'm assuming the county/country are assumed. If you break out their advanced search, they give you two extra fields for flat number and business name.
Given that some fields are combined on their site, you have to assume that there's some amount of validation to make sure that data entered can be gainfully used.
场所要素
道路要素
地点元素
邮政编码元素
此答案可能需要几年晚了,但它是针对像我这样正在寻求如何正确格式化邮政地址以存储在数据库(或类似数据库)中以及用于打印目的的指导的人。
取自皇家邮政文档,链接如下 -方便地命名为“程序员指南”
第 27 - 42 页对我来说最有帮助。
Premises elements
Thoroughfare elements
Locality elements
Postcode element
This answer may be a few years late, but it's aimed at those like myself looking for guidance on how to correctly format postal addresses for both storing in a database (or the likes of it) and for printing purposes.
Taken from Royal Mail Doc, link below - conveniently titled the 'Programmers Guide'
Page 27 - 42 was most helpful for me.
“英国”很可能也将向爱尔兰开放,并且在某些业务领域将存在法律差异,通常是苏格兰/北爱尔兰/海峡群岛与英格兰和威尔士之间。
简而言之,我会将国家/地区添加到列表中。 否则也没关系(当然也不少),当然任何地址都可以通过建筑物参考、邮政编码和国家来追踪。
It's very likely that a "UK" will be opened to Eire as well, and in some lines of business there will be legal differences, generally between Scotland / NI / the channel islands and England and Wales.
In short, I would add country to the list. Otherwise it's fine (no fewer certainly), though of course any address is traceable from a building reference, a post code and a country alone.
我们住在法国的地方只有 3 行:-
myname
村庄/地点名称
6 位数字邮政编码,后跟大写的邮政城镇名称
即使来自英国,这就是所需要的
Where we live in France its just 3 lines:-
myname
village/location name
6 digit postcode followed by post town name in uppercase
Even from UK that's all that is required