使用列的规范化具有冗余并且完全依赖于主键
Normalization with a column has a redundancy and fully depended on the primary key
我正在研究Normalization,知道Normalization的三种类型。
但是我还是有点疑惑!
举个例子
|- primary -|
product_name | price | category |
--------------------------------|
any name | 236 | food |
another name | 36 | clothes |
test name | 586 | food |
a name | 1036 | food |
现在 category
列有冗余,但取决于我对规范化的理解,这没有问题,因为 category
列 完全依赖于 像 2N
这样的主键,它没有像 3N
.
这样的 传递依赖性
但还是看到了冗余,会导致修改异常
我看应该是这样的
|- primary -|
product_name | price | category |
--------------------------------|
any name | 236 | 1 |
another name | 36 | 2 |
test name | 586 | 1 |
a name | 1036 | 1 |
id | category name |
-------------------|
1 | food |
2 | clothes |
如果有人能帮我解决这个问题,我会很高兴。
很抱歉我的英语不好或有语法错误之类的。
您 "see" 不是 "redundancy" 并且您提出的替代方案具有完全相同的 "redundancy" 因为现在您已经提到了三个不同的时间。
你提出的替代方案是 "better" 的唯一原因是如果需要 "food" 和 "clothes" 也可以用其他语言显示,我们会得到类似
id | lang | category name |
--------------------------|
1 | EN | food |
2 | EN | clothes |
1 | ES | comidas |
但是您的原始问题并没有说明这样的事情,就规范化而言,您的示例没有任何问题。
我正在研究Normalization,知道Normalization的三种类型。 但是我还是有点疑惑!
举个例子
|- primary -| product_name | price | category | --------------------------------| any name | 236 | food | another name | 36 | clothes | test name | 586 | food | a name | 1036 | food |
现在 category
列有冗余,但取决于我对规范化的理解,这没有问题,因为 category
列 完全依赖于 像 2N
这样的主键,它没有像 3N
.
但还是看到了冗余,会导致修改异常
我看应该是这样的
|- primary -| product_name | price | category | --------------------------------| any name | 236 | 1 | another name | 36 | 2 | test name | 586 | 1 | a name | 1036 | 1 | id | category name | -------------------| 1 | food | 2 | clothes |
如果有人能帮我解决这个问题,我会很高兴。
很抱歉我的英语不好或有语法错误之类的。
您 "see" 不是 "redundancy" 并且您提出的替代方案具有完全相同的 "redundancy" 因为现在您已经提到了三个不同的时间。
你提出的替代方案是 "better" 的唯一原因是如果需要 "food" 和 "clothes" 也可以用其他语言显示,我们会得到类似
id | lang | category name |
--------------------------|
1 | EN | food |
2 | EN | clothes |
1 | ES | comidas |
但是您的原始问题并没有说明这样的事情,就规范化而言,您的示例没有任何问题。