简体   繁体   English

您是否同意该表格已在3NF中标准化

[英]Do you agree that this table is normalized in 3NF

I was checking out tables normalization and see what I came to: 我正在检查表的规范化,看看我来了什么:

Describe and illustrate the process of normalizing the data shown in this table to third normal form (3NF) : 描述并说明将本表中显示的数据标准化为第三范式(3NF)的过程:

BRANCH_NO(PK)  BRANCH_ADDRESS    TELL_NO    MANAGER_ID    MANAGER_NAME
B001           ADDRESS 1         TELL 1     S1500         TOM DANIELS
B002           ADDRESS 2         TELL 2     S0010         MARY MARTINEZ
B003           ADDRESS 3         TELL 3     S0145         ART PETERS
B004           ADDRESS 4         TELL 4     S2250         SALLY STEM 

After thei transformation they end up with these two tables that they claim both are in 3NF: 转换之后,它们最终得到这两个表,它们都声称它们都位于3NF中:

BRANCH_NO(PK)  BRANCH_ADDRESS    TELL_NO    MANAGER_ID(FK)
B001           ADDRESS 1         TELL 1     S1500     
B002           ADDRESS 2         TELL 2     S0010     
B003           ADDRESS 3         TELL 3     S0145     
B004           ADDRESS 4         TELL 4     S2250

and

 MANAGER_ID(PK)    MANAGER_NAME
    S1500             TOM DANIELS
    S0010             MARY MARTINEZ
    S0145             ART PETERS
    S2250             SALLY STEM

I think that it is obvious that the first table is not a 3NF. 我认为很明显,第一个表不是3NF。 Eg : tell_no is dependent on branch_addres which is not the primary key but the primary key functionally identifies the branch_address which is a conflict with the transitional functional dependency. 例如:tell_no依赖于branch_addres,它不是主键,但是主键在功能上标识与过渡功能依赖项冲突的branch_address。

Normalization is all about ensuring that a database schema accurately represents a given set of dependencies. 规范化就是确保数据库模式准确地表示给定的一组依赖关系。 If you aren't given the dependencies to start with then such an exercise really comes down to guesswork and supposition based on a set of attribute names and a few rows of sample data. 如果没有给您提供依赖关系,那么这种练习实际上就是基于一组属性名称和几行示例数据的猜测和假设。 So there can't be any definitive answer about what is right and what is wrong. 因此,对于什么是对和什么是错,不可能有任何明确的答案。 It's more a case of understanding what assumptions are being made and what the consequences might be. 更多的情况是了解正在做出哪些假设以及可能产生的后果。 Write down what dependencies you expect to apply and then ensure that the schema is normalized with respect to those dependencies. 写下您希望应用的依赖项,然后确保已针对这些依赖项对架构进行了规范化。

Let's suppose that each Branch is required to have a unique branch number and a unique address and therefore we want to enforce these FDs: 假设每个分支都必须具有唯一的分支编号和唯一的地址,因此我们要强制执行以下FD:

BRANCH_NO -> BRANCH_ADDRESS
BRANCH_ADDRESS -> BRANCH_NO
BRANCH_NO -> TEL_NO
BRANCH_NO -> MANAGER_ID -> MANAGER_NAME

Your two-table design satisfies 3NF with respect to these dependencies, assuming that BRANCH_NO and BRANCH_ADDRESS are both going to be candidate keys (you need to consider all the keys and not just one primary key). 假设BRANCH_NO和BRANCH_ADDRESS都将是候选键(假设您需要考虑所有键,而不仅仅是一个主键),则您的两表设计就这些依赖关系满足3NF。

Now that does assume that the implied dependencies on BRANCH_ADDRESS are accurate and important enough that it makes sense to enforce the uniqueness of BRANCH_ADDRESS. 现在,这确实假定对BRANCH_ADDRESS的隐含依赖关系是准确且重要的,以至于可以强制执行BRANCH_ADDRESS的唯一性。 That may or may not be the case but that's why you need to determine such things before you can answer the question. 可能会,也可能不是,但这就是为什么您需要确定此类问题才能回答问题。

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

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