对第一范式的澄清 [英] Clarification on First Normal Form

查看:104
本文介绍了对第一范式的澄清的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


在大多数情况下,我理解第一,第二和第三范式。我想澄清一下我在网上找到的几个规范化例子。第一个例子如下:

For the most part, I understand first, second, and third normal form. I would just like clarification on a few normalization examples I found on the net. The first example is as follows:

UNF
Supplier: supplier_id, supplier_name, prod_code, prod_desc, cost, markup, dept_cd

1NF:
Supplier:  supplier_id, supplier_name
supplier_product:  supplier_id, prod_code, prod_desc, cost, markup, dept_cd

2NF:
Supplier:  supplier_id, supplier_name
supplier_product:  supplier_id, prod_code
product:  prod_code, prod_desc, cost, markup, dept_cd

3NF:
Supplier:  supplier_id, supplier_name
Product:  prod_code, prod_desc, dept_cd (FK), supplier_id (FK), cost, markup 
dept:  dept_cd, dept_name, aisle_no




来源:  http://cs.mvnu.edu/twiki/bin/view/Main/Lab8DB2013

Source: http://cs.mvnu.edu/twiki/bin/view/Main/Lab8DB2013


当从UNF移动到1NF时,我们是否只是将构成重复组的值与原始实体的主键一起移动到新实体中?在上面的示例中,产品和部门因此,两个都是
移动到第二个实体。

When moving from UNF to 1NF, are we simply moving the values that make up repeating groups to the new entity along with the primary key from the original entity? In the above example, products and departments are considered repeating groups. Thus, both are moved to the second entity.


这也可以在以下示例中演示:

This can also be demonstrated in the following example:

0NF
ORDER(order#, customer#, name, address, orderdate(product#, description, quantity, unitprice))
1NF
ORDER(order#, customer#, name, address, orderdate)
ORDER_LINE(order#, product#, description, quantity, unitprice)
2NF
ORDER(order#, customer#, name, address, orderdate)
ORDER_LINE(order#, product#, quantity)
PRODUCT(product#, description, unitprice)
3NF
ORDER(order#, customer#, orderdate)
CUSTOMER(customer#, name, address)
ORDER_LINE(order#, product#, quantity)
PRODUCT(product#, description, unitprice)




  • 资料来源:http://www4.comp.polyu.edu.hk/~cstyng/data.98 /tutorials/norm5.html
    项目代码,项目描述和项目主管是重复字段。





在这种情况下,只有产品被认为是重复组,而不是客户。因此,客户属性保留在原始实体中。我能理解这一点吗?

In this case, only products are considered to be a repeating group, not customers. Therefore, customer attributes are left in the original entity. Do I understand this correctly?


编辑:另一个证明我的观点的例子:

An additional example to demonstrate my point:

软件合同和咨询公司保留其员工当前参与的所有各种项目的详细信息
。这些详细信息包括: 将此数据规范化为第三范式。


  • 员工编号
  • 员工姓名
  • 出生日期
  • 部门代码
  • 部门名称
  • 项目代码
  • 项目描述
  • 项目主管
  • Employee Number
  • Employee Name
  • Date of Birth
  • Department Code
  • Department Name
  • Project Code
  • Project Description
  • Project Supervisor

  假设以下
并将此数据规范化为3NF:


  • < span style ="font-size:10pt; FONT-FAMILY:宋体,无衬线; border:1pt none windowtext; padding:0in">每个员工编号都是唯一的。
  • 每个部门都有一个部门代码。
  • 每个项目都有一个代码和主管。
  • 每个员工可以在一个或多个项目上工作。
  • 员工姓名不一定是唯一的。
  • 项目代码,项目描述和项目主管是重复字段
  • Each employee number is unique.
  • Each department has a single department code.
  • Each project has a single code and supervisor.
  • Each employee may work on one or more projects.
  • Employee names need not necessarily be unique.
  • Project Code, Project Description, and Project Supervisor are repeating fields

UNF

Employee Number, Employee Name, Date of Birth, Department
Code, Department Name, Project Code, Project Description, Project
Supervisor

1NF  

Employee Number, Employee Name, Date of Birth, Department Code, Department Name

Employee Number, Project Code,  Project Description, Project Supervisor 
 
 


2NF  

Employee Number, Employee Name, Date of Birth,
Department Code, Department Name

Employee Number, Project Code,

Project Code, Project Description, Project Supervisor 
 
 


3NF  

EmployeeNumber,Employee Name, Date of Birth,
*Department Code

Department Code, Department Name 

Employee Number, Project Code

Project Code,  Project
Description, Project Supervisor







推荐答案

这会有所帮助要知道你在哪里找到这些例子。

It would help to know where you found those examples.

1NF确实指定了"没有重复的群组",但如果产品可以来自多个供应商,那么第一个例子可能是错误的,而在第二个例子中例如,客户信息应该已经移动到2NF。

1NF does specify "no repeating groups," but the first example could be wrong if a product can come from multiple suppliers, and in the second example, the customer info should have been moved at 2NF.


这篇关于对第一范式的澄清的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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