database 您会为英国数据库使用多少个地址字段?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/373084/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 07:07:23  来源:igfitidea点击:

How many address fields would you use for a UK database?

databasenaming-conventionsstreet-address

提问by Draemon

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).

地址记录可能在大多数数据库中使用,但我见过一些用于存储它们的略有不同的字段集。字段的数量似乎从 3 到 7 不等,有时所有字段都简单地标记为 address1..addressN,其他时候给出特定含义(城镇、城市等)。

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
  • 地址1
  • 地址2
  • 地址 3
  • 邮政编码

We could add Country if we ever needed it (unlikely).

如果需要,我们可以添加 Country(不太可能)。

What do you think? Is this too little, too much?

你怎么认为?这太少了,太多了吗?

回答by chimp

The Post Office suggests (http://www.postoffice.co.uk/portal/po/content1?catId=19100182&mediaId=19100267) 7 lines:

邮局建议 ( http://www.postoffice.co.uk/portal/po/content1?catId=19100182&mediaId=19100267) 7 行:

  • Addressees Name
  • Company/Organisation
  • Building Name
  • Number of building and name of thoroughfare
  • Locality Name
  • Post Town
  • Post Code
  • 收件人姓名
  • 公司/组织
  • 建筑名称
  • 建筑物编号及道路名称
  • 地区名称
  • 驿站
  • 邮政编码

They then say you do not need to include a County name provided the Post Town and Postcode are used.

然后他们说您不需要包含县名,前提是使用了邮政镇和邮政编码。

回答by Johnno Nolan

The BSIhave BS 7666 - that covers all addressing. I recommend you look there.

BSI有BS 7666 -涵盖所有寻址。我建议你去那里看看。

The 2000 version recommends

2000版推荐

An address shall be based upon a logical data model comprising the following entities:

地址应基于包含以下实体的逻辑数据模型:

  1. addressable object, with sub-types:
    • primary addressable object;
    • secondary addressable object;
  2. street;
  3. locality;
  4. town;
  5. administrative area, a.k.a. district;
  6. county;
  7. postcode.
  1. 可寻址对象,具有子类型:
    • 主要可寻址对象;
    • 次要可寻址对象;
  2. 街道;
  3. 地点;
  4. 镇;
  5. 行政区,又名区;
  6. 县;
  7. 邮政编码。

See: http://landregistry.data.gov.uk/def/common/BS7666Address

参见:http: //landregistry.data.gov.uk/def/common/BS7666Address

回答by Luthfur

Premises elements

处所要素

  • Sub Building Name
  • Building Name
  • Building Number
  • Organisation Name
  • Department Name
  • PO Box Number
  • 子楼名称
  • 建筑名称
  • 楼号
  • 机构名称
  • 部门名称
  • 邮政信箱号码

Thoroughfare elements

通路要素

  • Dependent Thoroughfare Name
  • Dependent Thoroughfare Descriptor
  • Thoroughfare Name
  • Thoroughfare Descriptor
  • 附属通路名称
  • 相关通路描述符
  • 道路名称
  • 通路描述符

Locality elements

地方元素

  • Double Dependent Locality
  • Dependent Locality
  • Post Town
  • 双重依赖局部性
  • 从属地方
  • 驿站

Postcode element

邮政编码元素

  • Postcode
  • 邮政编码

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'

取自 Royal Mail Doc,下面的链接 - 方便地命名为“程序员指南

Page 27 - 42 was most helpful for me.

第 27 - 42 页对我帮助最大。

回答by BenAlabaster

If I were you, I'd call Royal Mailand 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:

自从我搬到加拿大后,我不得不做类似的事情,这比简单的居住地址复杂得多,通常有:

  • Street Number if applicable
  • Street Number Suffix if applicable
  • House Name
  • Street Name
  • Street Type
  • Street Direction if applicable
  • Unit Number for flats, townhouses or other types of building/location
  • Minor Municipality (Village)
  • Major Municipality (Major Town/City)
  • County
  • PostCode
  • Country if you include Scotland, Wales, Northern Ireland (and now I noticed Eire)
  • 街道号码(如果适用)
  • 街道号码后缀(如适用)
  • 房子的名字
  • 街道名称
  • 街道类型
  • 街道方向(如果适用)
  • 公寓、联排别墅或其他类型的建筑物/位置的单元号
  • 小自治市(村)
  • 主要自治市(主要城镇/城市)
  • 邮政编码
  • 国家,如果你包括苏格兰、威尔士、北爱尔兰(现在我注意到爱尔兰)

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.

编辑:您的 3 字段方法还不错……尤其是。但是,使用您拥有的字段设置进行数据清理可能是一个重要问题,您可能需要一个相当复杂的策略来确保输入的地址有效。与从组合字段中解析各种地址标记相比,清理单个专用字段以确保输入正确要容易得多。

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.

在他们的主要邮政编码查找中,他们使用了 4 个字段,我猜他们对街道名称/类型字段进行了某种形式的验证。他们将门牌号和姓名分开,我猜他们只允许主要自治市。我假设假设县/国家。如果您打破他们的高级搜索,他们会为您提供两个额外的字段,用于固定电话号码和公司名称。

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.

鉴于某些字段在其站点上组合在一起,您必须假设有一定数量的验证以确保输入的数据可以被有收益地使用。

回答by Jonathan Leffler

I don't know whether this is minimal (I doubt it) but the heading on my cheque book says something pretty close to:

我不知道这是否是最小的(我对此表示怀疑),但我支票簿上的标题非常接近:

Lloyds TSB
Isle of Man Offshore Centre
Peveril Buildings
Peveril Square
Douglas
Isle of Man
IM99 0XX
United Kingdom

This causes fits when I try to enter it into the US banking system.

当我尝试将其输入美国银行系统时,这会导致匹配。

回答by annakata

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.

很有可能“英国”也将向爱尔兰开放,并且在某些业务领域会有法律差异,通常在苏格兰 / NI / 海峡群岛与英格兰和威尔士之间。

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.

简而言之,我会将国家添加到列表中。否则它很好(肯定不会更少),尽管当然任何地址都可以从建筑物参考、邮政编码和国家/地区进行追踪。

回答by Jim GRAY

Where we live in France its just 3 lines:-

我们住在法国的地方只有 3 条线路:-

myname
village/location name
6 digit postcode followed by post town name in uppercase

myname
村庄/地点名称
6 位邮政编码,后跟大写的城镇名称

Even from UK that's all that is required

即使来自英国,这也是所需要的