学习数据库规范化

学习数据库规范化

本文介绍了学习数据库规范化,混淆约2NF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在看这个视频在YouTube上的规范化,我不得不说我现在很困惑,我可能在视频中的错误,即使它有25个喜欢,只有1不喜欢。

I was looking at this video on normalization on youtube and I have to say I am confused now, I there might be errors in the video even though it has 25 likes and only 1 dislike.

作者说,Assignment Description列取决于Assignment ID列。 ..yet有相同的分配ID的不同分配描述。然后,通过将该表分成两个表,其中之一仅包含作业ID和作业描述,将该表归一化为2NF。而这个表甚至不是1NF(非唯一主键),那么怎么可能是2NF?

The author says the 'Assignment Description' column depends on the Assignment ID column...yet there are there are different Assignment Descriptions for the same Assignment ID. He then 'normalizes' this table into 2NF by breaking it into two tables...one of them containing only Assignment ID and Assignment Description. And this table is not even in 1NF (non unique primary key) so how can it be 2NF?

有人能告诉我这个视频是正确的还是不正确的2NF?

Can someone tell me if this video is correct or incorrect regarding 2NF?

推荐答案

从关系的角度来看,该视频最多只是草率和粗心。它的一些部分是错误的,包括你引用的部分。不要再观看数据库规范化主中的任何视频。

From the relational point of view, that video is, at best, sloppy and careless. Some parts of it are simply wrong, including the part you cite. Don't watch any more videos from the "Database Normalization Master".

如果关系为2NF,必须

For a relation to be in 2NF it must



如果属性取决于 >任何候选键,则存在部分键依赖关系,并且关系不在2NF中。

If an attribute depends on part of any candidate key, then there's a partial key dependency, and the relation is not in 2NF.

视频试图创建的一个点是,如果主键是单列,则关系保证为2NF。但请查看此表格(来自)。

One point the video tries to make is that if the primary key is a single column, the relation is guaranteed to be in 2NF. But look at this table (from Wikipedia entry for 2NF).

Employees' Skills
--
Employee    Skill           Current Work Location
Jones       Typing          114 Main Street
Jones       Shorthand       114 Main Street
Jones       Whittling       114 Main Street
Bravo       Light Cleaning  73 Industrial Way
Ellis       Alchemy         73 Industrial Way
Ellis       Flying          73 Industrial Way
Harrison    Light Cleaning  73 Industrial Way

此关系只有一个候选键{Employee,Skill}。但是在Employee和当前工作位置之间存在部分关键依赖。给定Employee的任何值,我们发现当前工作位置只有一个值。

This relation has only one candidate key, {Employee, Skill}. But there's a partial key dependency between Employee and Current Work Location. Given any value for Employee, we find one and only one value for Current Work Location.

将主键更改为代理ID号不会改变情况,虽然

Changing the primary key to a surrogate ID number won't change the situation, although the video implies it will.

Employees' Skills
--
ID  Employee    Skill           Current Work Location
1   Jones       Typing          114 Main Street
2   Jones       Shorthand       114 Main Street
3   Jones       Whittling       114 Main Street
4   Bravo       Light Cleaning  73 Industrial Way
5   Ellis       Alchemy         73 Industrial Way
6   Ellis       Flying          73 Industrial Way
7   Harrison    Light Cleaning  73 Industrial Way

主键是一个单列,他们说保证这个关系是在2NF。但它不是。视频制作者忽略了最个表具有多个候选键的事实,并且归一化考虑了每个候选键,而不仅仅是称为主键的特殊候选键。

The primary key is a single column, which they say guarantees this relation is in 2NF. But it isn't. The video makers ignore the fact that most tables have multiple candidate keys, and that normalization takes every candidate key into account, not just the "special" candidate key called the primary key.

这部影片有许多其他问题,有很多,我没有一直观看。生命太短,浪费了一分钟。

There are a lot of other problems with this video--so many that I didn't watch it all the way through. Life's too short to waste another minute on it.

这篇关于学习数据库规范化,混淆约2NF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-03 22:15