简体   繁体   English

将1NF表标准化为3NF

[英]Normalizing 1NF table to 3NF

I am learning Normalization in class. 我在课堂上学习标准化。 And I found this exercise in this article here 我在这里的这篇文章中找到了这个练习

It asks to normalize the following table to 3NF. 它要求将下表标准化为3NF。
在此处输入图片说明

This is how I did it. 这就是我做的。 在此处输入图片说明

I would like to know if the way I have organized the tables is correct or not. 我想知道我整理表格的方式是否正确。

I would like to know if the way I have organized the tables is correct or not. 我想知道我整理表格的方式是否正确。

No, it's not. 不,这不对。

First, normalization through BCNF is based on functional dependencies. 首先,通过BCNF的规范化基于功能依赖性。 You haven't identified any functional dependencies. 您尚未确定任何功能依赖性。

Second, normalization never introduces new attributes that weren't in the relation you started with. 其次,规范化永远不会引入与您最初建立的关系中不存在的新属性。 You introduced the new attributes "sFirstName", "sLastName", "dateOfBirth", "tuteId", "tutorName", "bookId", and "bookName". 您引入了新属性“ sFirstName”,“ sLastName”,“ dateOfBirth”,“ tuteId”,“ tutorName”,“ bookId”和“ bookName”。

Finally, online exercises like the one you linked to aren't very useful. 最后,像您链接到的在线练习并不是很有用。 The author clearly expects you to derive all the functional dependencies from the small table provided, but you can't do that reliably unless the data are representative. 作者显然希望您从提供的小表中得出所有功能依赖关系,但是除非数据具有代表性,否则您不能可靠地做到这一点。 For example, you can determine by inspection that Room->Date, but in the real world that doesn't make much sense. 例如,您可以通过检查确定Room-> Date,但在现实世界中这没有多大意义。

Normalization is based on semantics--what does the data mean ? 规范化基于语义-数据什么意思 What does "Date" mean here? “日期”在这里是什么意思? The data supports all these interpretations. 数据支持所有这些解释。 (And more.) (和更多。)

  • The only date a room will be used. 使用房间的唯一日期。 (Room->Date) (房间->日期)
  • The first date a room will be used. 将使用一个房间的第一次约会。 (Room->Date) (房间->日期)
  • The date a book was published (Book->Date) 一本书的出版日期(Book-> Date)
  • The date a student signed up for a unit (StudentId, UnitId->Date) 学生签署单元的日期(StudentId,UnitId-> Date)

Based solely on the data, you could claim that Grade->Date, but that makes no sense. 仅基于数据,您可以声明“成绩->日期”,但这没有任何意义。 Nonsense like that tells you the data isn't representative, and that you can normalize the table only by using information that the author didn't provide . 像这样的废话告诉您数据不是代表性的,并且只能使用作者未提供的信息来标准化表格。

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

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