针对CustNo,PropNo,OwnerNo等的3NF CustomerRental数据库规范化过程 [英] Database Normalization Process to 3NF CustomerRental for CustNo, PropNo, OwnerNo, etc

查看:267
本文介绍了针对CustNo,PropNo,OwnerNo等的3NF CustomerRental数据库规范化过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在试图规范下表。我想从UNF表格转到3NF表格。我想知道,您在1NF阶段做什么?它表示在此处删除重复的列或组(例如ManagerID,ManagerName)。这被认为是重复的,因为它导致相同的数据。

I am trying to normalize the following table. I want to go from the UNF form to 3NF form. I want to know, what do you do at the 1NF stage? It says it's where you remove the repetitive columns or groups (ex. ManagerID, ManagerName). This is considered repetitive because it's leads to the same data.

非规范化数据表具有以下列
CustomerRental(CustNo,CustName,PropNo,PAddress,RentStart ,RentFinish,Rent,OwnerNo,OName)

The Unnormalized data table has the following columns CustomerRental(CustNo,CustName,PropNo,PAddress,RentStart,RentFinish,Rent,OwnerNo,OName)

没有重复的列/字段,每个单元格都有一个值,但是没有主键。我在表中看到的功能依赖项是:

There are no repeating columns/fields and each cell has a single value, but there is not a primary key. The functional dependencies I see in the table are:

{CustNo}->{Cname}
{PropNo}->{Paddress,RentStart,RentFinish,Rent,OwnerNo,Oname}
{CustNo,PropNo}->
    {Paddress,RentStart,RentFinish,Rent,OwnerNo,OName,CustName}
{OwnerNo,PropNo}->{Rent,Paddress,Oname,RentInfo} 

我选择的主键是复合键CustNo + PropNo。由于它具有主键,因此该表采用1NF格式,对吗?这就是我的想法,但是答案从表中排除了CustNo和CustName。它们在自己的表中。

The primary key I picked was a composite key, CustNo + PropNo. Since it has a primary key, the table is in 1NF form, correct? This is what I thought, but the answer excludes CustNo and CustName from the table. They are in their own table.

从上面的我将其归一化为2NF 。在这一阶段,您应该确保所有非主属性都完全依赖主键。不是这种情况。这些是表中的功能依赖性:

From the above, I normalized it 2NF. At this stage, you are supposed to ensure that all non-prime attributes are fully dependent on the primary key. This is not the case. These are the functional dependencies in the table:

{OwnerNo}->{Oname}
{CustNo}->{CustName}
{PropNo}->{Paddress,Rent,OwnerNo,Oname}

我将这些值移出表以创建2NF形式的三个新表:

I moved these values out of the table to create three new tables in 2NF form:

Customers(CustNo(PK),CustName)
Property(PropNo(PK),Paddress,City,Rent,OwnerNo,OwnerName)
Rentals(RentalNo(PK),CustNo,OwnerNo,PropNo,RentStart,RentFinish)

现在,主表Rentals是2NF形式。它有一个主键,RentalNo,每个非主属性都取决于它。

Now the main table, Rentals, is in 2NF form. It has a primary key, RentalNo, and each of the non-prime attributes depends on it.

我认为对它有传递的依赖。您可以通过PropNo查找OwnerNo。因此,要使其符合3NF规则,必须将OwnerNo移到其自己的表中以创建这些表:

I think that there is a transitive dependency on it. You can find OwnerNo through the PropNo. So, to make it comply with 3NF rules, you have to move the OwnerNo to its own table to create these tables:

Customers(CustNo,CustName)
Property(PropNo,Paddress,City,Rent)
Owners(OwnerNo,OwnerName)
Rentals(RentalNo,CustNo,PropNo,RentStart,RentFinish)

这正确吗?我读到在1NF阶段,应该删除重复的列(例如OwnerNo,OwnerName)。这是真的?为什么或为什么不呢?

Is this correct? I read that at the 1NF stage, you are supposed to remove repetitive columns (ex. OwnerNo,OwnerName). Is this true? Why or why not?

显示我的桌子的图片在这里:
规范化表

The picture showing my tables is here: Normalized Tables

推荐答案

我们不规范化为NF(正常形式)通过它和1NF之间的较低NF。我们对我们想要的NF使用了经过验证的算法。在出版的学术教科书中找到一个。 (如果这没有描述您被告知要使用的参考文献,请找到该参考文献并引用它。)

We don't normalize to a NF (normal form) by going through lower NFs between it and 1NF. We use a proven algorithm for the NF we want. Find one in a published academic textbook. (If that doesn't describe the reference(s) you were told to use, find one that it does & quote it.)

请密切注意这些术语和步骤。细节很重要。例如,您将需要知道所有的FD(功能依赖项),而不仅仅是其中的一些。例如,只要某些FD成立,阿姆斯特朗公理生成的所有FD都会成立。例如,PK(主键)无关紧要,CK(候选键)很重要。例如,每个表都有一个CK。例如,对较高NF的规范化不会更改列名称。因此,您的问题已经不能反映正确的过程。

Pay close attention to the terms and steps. Details matter. Eg you will need to know all the FDs (functional dependencies) that hold, not just some of them. Eg whenever some FDs hold, all the ones generated by Armstrong's axioms hold. Eg PKs (primary keys) are irrelevant, CKs (candidate keys) matter. Eg every table has a CK. Eg normalization to higher NFs does not change column names. So already your question does not reflect a correct process.

您确实需要阅读&引用您被告知为了到达 1NF而使用的参考,因为 1NF在您的眼中情人。归一化为较高的NF可以在任何关系上使用。

You really need to read & quote the reference(s) you were told to use in order to get to "1NF", because "1NF" is in the eye of the beholder. Normalization to higher NFs works on any relation.

这篇关于针对CustNo,PropNo,OwnerNo等的3NF CustomerRental数据库规范化过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆