Getting a database to 1NF or 2NF - mysql

蓝咒 提交于 2019-12-25 03:12:21

问题


How do I get this mysql database in better 1NF or 2NF form?

I tried my best to remove redundant data. It appears there is redundant data still in "Prof_Dept"


回答1:


The schema looks strange. How can a Department by a child of Professor_Dept (with the Professor_DeptID FK in it)? That means there is no "Science faculty". You would be storing

professor john's science department
professor john's physics department
professor tom's physics department
etc

I think the tables should be

Professor
Department
   <bridge between the two> (Professor_Dept)
Course
   (this hangs off the bridge table, since the combination
    defines the Course instructor [professor] and department)

Professor: id, name, e.g. "John"
Department: id, name, e.g. "COM"
Professor_Dept: id, professor_id (FK), department_id (FK), modified_date
Course: Professor_Dept_id (FK), number, course_modified

From a course, you already know through the FK which professor and dept it relates to.



来源:https://stackoverflow.com/questions/5372258/getting-a-database-to-1nf-or-2nf-mysql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!