邮政编码和邮政编码是否违反第三范式?

发布于 2024-07-18 00:58:39 字数 63 浏览 6 评论 0原文

鉴于状态信息隐含在邮政编码中,是否存储它们都违反了第三范式? 您是否可以或者应该简单地将它们合并到一个领域中?

Given that state information is implicit in the zip code aren't storing both of them some violaiton of third normal form? Can or should you simply combine them into one field?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

蝶…霜飞 2024-07-25 00:58:39

根据这篇文章,有一些邮政编码跨越州界。 所以不,这并不违反 3NF。

实际上,邮政编码跨越州界的情况很少见。 通常是由于访问问题造成的,例如位于军事基地或由于交通网络的限制。

密苏里州 Protem(邮政编码 65733)就是这样一个案例。 Bull Shoals Lake 以北的一些阿肯色州道路最好通过 Protem 投递单位而不是阿肯色州邮局到达。 此类道路的一些示例包括邮编 65733 的高速公路运输路线 H002 上的 Ann Street、Kalijah Road、McBride Road、Red Oak Lane 和 Vance Road。McBride Road 实际上跨越州界。 如果您在在线地图程序中查看道路网络,您会发现,来自阿肯色州钻石城(邮政编码 72644)附近、Bull Shoals 湖南侧的乡村运输公司需要行驶几英里才能到达能够进入上面列出的道路。

再例如,肯塔基州坎贝尔堡(邮政编码 42223)在田纳西州内也存在一些道路。

According to this post, there are a few zip codes that cross state boundaries. So no, it is not a violation of 3NF.

Actually, there are a few rare cases where a ZIP Code crosses state boundaries. Usually it is due to access problems, such as being on a military base or due to constraints of the transporation network.

One such case is Protem, Missouri (ZIP Code 65733). Some of the Arkansas roads north of Bull Shoals Lake can best be accessed by the Protem delivery unit rather than an Arkansas post office. Some examples of such roads include Ann Street, Kalijah Road, McBride Road, Red Oak Lane, and Vance Road on Highway Carrier Route H002 in ZIP Code 65733. McBride Road actually crosses across the state boundary. If you look at the road network in an online mapping program, you can see that a rural carrier from say, nearby Diamond City, AR (ZIP code 72644), on the south side of Bull Shoals Lake, would need to drive several miles to be able to access the roads listed above.

For another example, Fort Campbell, Kentucky (ZIP Code 42223) also has some roads that exist within Tennessee.

起风了 2024-07-25 00:58:39

该说法实际上并不适用于所有地理区域。 澳大利亚有一些跨越州界但拥有相同邮政编码的姐妹城市。

3NF 虽然非常有用,但也不是不可侵犯的。 出于性能原因,我有时会将一些表信息恢复为 2NF。

That statement isn't actually true in all geographical areas. Australia has a few sister cities that straddle state boundaries yet share the same postcode.

And 3NF, while incredibly useful, is not inviolable. I've sometimes reverted some table information back to 2NF for performance reasons.

野生奥特曼 2024-07-25 00:58:39

没有。 有些邮政编码跨越州界。 有关一些示例,请参阅维基百科。 此外,规范化减少了冗余,而地址实际上是相当复杂的东西,很容易出现一个组件错误。 冗余意味着即使部分地址错误,邮件也很有可能到达目的地。

我记得有一次,一位来自欧洲的徒步旅行者住在我的兄弟会,想寄一封感谢信。 他不太了解美国的地址或地理,因此当他寄出便条时,收件人是“<兄弟会名称><大学名称不太正确>新英格兰?美国”。 邮件居然真的到了,真是太神奇了。

地址中的冗余可能是一件非常好的事情,并且您通常不应该对地址做出不必要的假设。 例如,有些人没有门牌号码;有些人则没有。 您输入“一般投递”,邮递员希望知道信件的去向(或者如果他不知道,您可以在邮局取信)。

Nope. There are some zip codes that cross state lines. See Wikipedia for some examples. Furthermore, normalization reduces redundancy, while addresses are actually fairly complicated things that are easy to get one component of wrong. Redundancy means that even if part of the address is wrong, there is a good chance that the mail will be able to get where its going.

I recall a time when a hiker from Europe stayed at my fraternity, and wanted to send a thank-you note. He did not understand American addresses or geography very well, so when he sent the note it was addressed to "<fraternity name> <not quite correct name of university> New England? USA". The mail actually got there, amazingly enough.

Redundancy in addresses can be a very good thing, and you generally shouldn't assume more about an address than you need to. For instance, some people don't have a street number; you put "general delivery", and the mailman is expect to know where the letter goes (or you can pick it up at the post office if he doesn't).

亢潮 2024-07-25 00:58:39

还有一个不同的问题。 您可能想要区分输入的数据(可能存在冲突)和从中得出的结论。

There is a different issue. You might want to make a difference between the data that was entered (which could be conflicting) and the conclusion you make from that.

倒数 2024-07-25 00:58:39

3NF 违规示例

让我们看一下下面博客文章项目的非规范化表。 这不是第三范式,它已经被破坏了。 假设有多个
同一作者的帖子,我们可能会更新几行,而其他行则不更新。 导致表数据不一致。

denormalized table for a blog posts project

Hence这违反了规范化,因为它违反了以第三范式描述规范化表的常见方法,即表中的每个非键属性都必须提供有关键的事实,整个键,除了关键。 这对你在美国法庭上所说的话来说是一个文字游戏,说实话,全部真相,除了真相之外别无其他。 在这种情况下,关键是Post Id,并且有一个非关键属性Author Email,它不遵循该属性。 因为它确实讲述了一些关于作者的事情。 因此,它违反了第三范式,没有实现标准化目标

希望这会有所帮助。

3NF violation by example

Let's look at the below denormalized table for a blog posts project. It's not the 3rd normal form, it's broken. Let's say there are multiple
posts with same author, we may update a few rows and leave others un-updated. Leaving the table data inconsistent.

denormalized table for a blog posts project

Hence this violates normalization because it violates a common way to describing normalized tables in 3rd normal form, which is that every non-key attribute in the table must provide a fact about the key, the whole key and nothing but the key. And that's of a play on words for what you say in a US courtroom, telling the truth, the whole truth and nothing but the truth. The key in this case, is the Post Id and there is a non-key attribute Author Email which does not follow that. Because it does, in fact tell something about the author. And so it violates that 3rd normal form by not achieving the goals of normalization

hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文