数据库正常化 - 谁是对的? [英] Database normalization - who's right?

查看:926
本文介绍了数据库正常化 - 谁是对的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的教授(谁声称对系统开发有多年的坚定理解),我正在争论我们的数据库的设计。




我的教授坚持这个设计是正确的:
(列的列表)

  Subject_ID 
说明
Units_Lec
Units_Lab
Total_Units

/ p>

请注意总单位列。他说,这一列必须包括。
我试图解释这是没有必要的,因为如果你想要的话,只要简单的添加两个查询。



我给他一个例子我在一本书中发现,但他坚持认为,我不必依靠书籍来制作我们的系统。
同样的情况也适用于这个类似的情况:

  student_ID 
preliminary_grade
midterm_grade
prefinal_grade
average

ect ...



他希望我包括平均值!在任何地方,我可以找到自己阅读的文章,说服我,这是违反了规范化。如果我需要平均值,我可以轻松计算三个等级。他列举了一些场景,包括('嘿!如果查询被意外删除了怎么办?你会做什么?这是为什么你需要将它包含在你的表中!



我需要重建我的数据库(包括大约40多个表)以符合他想要的?我错了,只是忽略了这些事情?



编辑:



事情是,他想把总金额包括在付款表中,我相信这是不必要的(只需计算产品的单价和数量)。他指出,我们需要这个列来计​​算对整个系统管理至关重要的借记和/或信用,以及它是平衡事务所需的。请告诉我你的想法。

解决方案

你绝对正确!规范化的规则之一是减少那些可以通过使用其他属性值容易推断的属性。即,通过执行一些数学计算。在你的情况下,总单位列可以通过简单的添加。



告诉你的教授,有那个特定的列将显示传递依赖的明确迹象,根据第三规范化规则,建议减少这些。


My professor(who claimed to have a firm understanding about systems development for many years) and I are arguing about the design of our database.

As an example: My professor insists this design is right: (list of columns)

Subject_ID
Description
Units_Lec
Units_Lab
Total_Units

etc...

Notice the total units column. He said that this column must be included. I tried to explain that it is unnecessary, because if you want it, then just make a query by simply adding the two.

I showed him an example I found in a book, but he insists that I dont have to rely on books too much in making our system. The same thing applies to similar cases as in this one:

student_ID
prelim_grade
midterm_grade
prefinal_grade
average

ect...

He wanted me to include the average! Anywhere I go, I can find myself reading articles that convince me that this is a violation of normalization. If I needed the average, I can easily compute the three grades. He enumerated some scenarios including ('Hey! What if the query has been accidentally deleted? What will you do? That is why you need to include it in your table!')

Do I need to reconstruct my database(which consists of about more than 40 tables) to comply with what he want? Am I wrong and just have overlooked these things?

EDIT:

Another thing is that he wanted to include the total amount in the payments table, which I believe is unnecessary(Just compute the unit price of the product and the quantity.). He pointed out that we need that column for computing debits and/or credits that are critical for the overall system management, that it is needed for balancing transaction. Please tell me what you think.

解决方案

You are absolutely correct! One of the rules of normalization is to reduce those attributes which can be easily deduced by using other attributes' values. ie, by performing some mathematical calculation. In your case, the total units column can be obtained by simply adding.

Tell your professor that having that particular column will show clear signs of transitive dependency and according to the 3rd normalization rule, its recommended to reduce those.

这篇关于数据库正常化 - 谁是对的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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