简体   繁体   English

归一化 3NF

[英]Normalization 3NF

I an reading through some examples of normalization, however I have come across one that I do not understand.我阅读了一些规范化的例子,但是我遇到了一个我不明白的例子。

The website the example is located here: http://cisnet.baruch.cuny.edu/holowczak/classes/3400/normalization/#allinone该示例的网站位于此处: http://cisnet.baruch.cuny.edu/holowczak/classes/3400/normalization/#allinone

The part I do not understand is "Third Normal Form"我不明白的部分是“第三范式”

In my head I see the transitive dependencies in EMPLOYEE_OFFICE_PHONE (Name, Office, Floor, Phone) as the following Name->->Office|Floor and Name->->Office|Phone在我的脑海中,我看到EMPLOYEE_OFFICE_PHONE (Name, Office, Floor, Phone)中的传递依赖关系如下Name->->Office|FloorName->->Office|Phone

The author splits the table EMPLOYEE_OFFICE_PHONE (Name, Office, Floor, Phone) into EMPLOYEE_OFFICE (Name, Office, Floor) and EMPLOYEE_PHONE (Office, Phone)作者将表EMPLOYEE_OFFICE_PHONE (Name, Office, Floor, Phone)拆分为EMPLOYEE_OFFICE (Name, Office, Floor)EMPLOYEE_PHONE (Office, Phone)

From my judgement in the beginning, I still see the transitive dependency in Name->->Office|Floor so I don't understand why it is in 3NF.从我一开始的判断来看,我仍然在Name->->Office|Floor中看到传递依赖,所以我不明白为什么它在 3NF 中。 Was I wrong to state that there is a transitive dependency in Name->->Office|Floor ?我对 state 是否错在Name->->Office|Floor中存在传递依赖?

Reasoning for transitivity: Here is my list of the functional dependencies传递性的推理:这是我的函数依赖列表

  1. Name -> Office名称 -> 办公室
  2. Name -> Floor名称 -> 楼层
  3. Name -> Phone姓名 -> 电话
  4. Office -> Phone办公室 -> 电话
  5. Office -> Floor (Is this the incorrect one? and why?办公室 -> 楼层(这是不正确的吗?为什么?

Thank-you your help everyone!谢谢大家的帮助!

5) you assume a naming sheme here... offices 4xx have to be on floor 4... 5xx have to be on floor 5... if such a scheme exists, you can have your dependency... as long as this is not part of the specification... no. 5)你在这里假设一个命名方案......办公室4xx必须在4楼...... 5xx必须在5楼......如果存在这样的方案,你可以拥有你的依赖......只要这个不是规范的一部分……不。 5 is out of the game... 5号没戏了……

First of all,let me define 3NF clearly:- A relation is in 3NF if following conditions are satisfied:- 1.)Relation is in 2NF 2.)No non prime attribute is transitively dependent on the primary key.首先,让我明确定义 3NF:- 如果满足以下条件,则关系在 3NF 中:- 1.) 关系在 2NF 中 2.) 没有非素数属性传递依赖于主键。 In other words,a relation is in 3NF is one of the following conditions is satisfied for every functional dependency X->Y:- 1.)X is superkey 2.)Y is a prime attribute For Your Question,if the following FDs are present:-换句话说,在 3NF 中的关系对于每个函数依赖 X->Y 都满足以下条件之一:- 1.)X 是超键 2.)Y 是您的问题的主要属性,如果以下 FD 是当下:-

 Name -> Office
 Name -> Floor
 Name -> Phone
 Office -> Phone

Then we cannot say anything about Office and Floor.You can verify this by applying and checking any of the Armstrong Inference Rules.When you apply these rules, you will find that you cannot infer anything about office and floor.那么我们就不能说关于办公室和楼层的任何事情。您可以通过应用和检查任何阿姆斯壮推理规则来验证这一点。当您应用这些规则时,您会发现您无法推断出办公室和楼层的任何内容。

1. Name -> Office
2. Name -> Floor
3. Name -> Phone
4. Office -> Phone
5. Office -> Floor (Is this the incorrect one? and why?

(1) You and the author and I agree that Name->Office. (1) 你、作者和我同意Name->Office。

(2) You and the author agree that Name->Floor. (2) 您和作者同意Name->Floor。 While that's true based solely on the sample data, it's also true that Office->Floor.虽然仅基于样本数据确实如此,但 Office->Floor 也是如此。 I'd explore this kind of issue by asking this question: "If an office is empty, do I still know what floor that office is on?"我会通过问这个问题来探索这类问题:“如果办公室是空的,我还知道办公室在哪一层吗?” (Yes) (是的)

Those things suggest there's a transitive dependency, Name->Office, and Office->Floor.这些事情表明存在传递依赖关系,名称->办公室和办公室->楼层。 So I would disagree with you and with the author on this one.所以我不同意你和作者的观点。

(3) You say Name->Phone. (3) 你说名字->电话。 The author says Office->Phone.作者说Office->Phone。 The author also says that "each office has exactly one phone number."作者还说“每个办公室只有一个电话号码”。 So given one value for Office, I know one and only one value for Phone.因此,给定 Office 的一个值,我只知道一个 Phone 的值。 And given one value for Name, I know one and only one value for Phone.给定一个 Name 值,我只知道一个 Phone 值。 I'd explore this issue by asking, "If I move to a different office, does my phone number follow me?"我会通过问“如果我搬到不同的办公室,我的电话号码会跟随我吗?”来探索这个问题。 If it does, then Name->Phone.如果是这样,那么名称-> 电话。 If it doesn't, then Office->Phone.如果没有,则 Office-> 电话。

There isn't enough information here to answer that question, and I've worked in offices that worked each of those two ways, so real-world experience doesn't help us very much, either.这里没有足够的信息来回答这个问题,而且我在办公室工作过这两种方式中的每一种,所以现实世界的经验也对我们没有太大帮助。 I'd have to side with the author in this case, although I think it's not very well thought through for a normalization example.在这种情况下,我不得不站在作者一边,尽管我认为对于一个规范化的例子来说,它并没有经过深思熟虑。

(4) This is really just an extension of (3) above. (4) 这实际上只是上面 (3) 的扩展。

(5) See (2) above. (5) 见上文 (2)。 This doesn't have anything to do with a naming scheme, and you don't need to assume that offices numbered 5xx are on the 5th floor.这与命名方案没有任何关系,您无需假设编号为 5xx 的办公室位于 5 楼。 The only relevant question is this: Given one value for Office, is there one and only one value for Floor?唯一相关的问题是:给定 Office 的一个值,Floor 是否只有一个值? (Yes) I might explore this issue by asking "Can one office be on more than one floor?" (是)我可以通过问“一个办公室可以在多个楼层上吗?”来探讨这个问题。 (In the real world, that's remotely possible. But the sample data doesn't support that possibility.) (在现实世界中,这几乎是可能的。但样本数据不支持这种可能性。)

Some additional FDs, based solely on the sample data.一些额外的 FD,仅基于样本数据。

Phone->Office
Phone->Floor
Office->Name

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM