获取数据库到1NF或2NF - mysql [英] Getting a database to 1NF or 2NF - mysql

查看:182
本文介绍了获取数据库到1NF或2NF - mysql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何让这个mysql数据库更好的使用1NF或2NF格式?

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

我尽力删除冗余数据。 Prof_Dept中仍然存在冗余数据

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

推荐答案

模式看起来很奇怪。教授的一个孩子怎么可以(教授-DeptID FK在里面)?那意味着没有科学教师。你将存储

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

我认为这些表应该是

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中有哪位教授和部门。

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

这篇关于获取数据库到1NF或2NF - mysql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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