获取数据库为1NF或2NF - mysql

时间:2011-03-20 23:16:19

标签: mysql database-design normalization database-schema

如何以更好的1NF或2NF格式获取此mysql数据库?

enter image description here

我尽力删除冗余数据。看来“Prof_Dept”中还有冗余数据

1 个答案:

答案 0 :(得分:1)

架构看起来很奇怪。一个部门怎么可以由一个教授_Dept的孩子(与教授_DeptID FK在一起)?这意味着没有“科学教员”。你将存储

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

我认为表格应该是

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

从一门课程中,你已经通过FK了解了它所关联的教授和部门。