mysql - 将数据库设置为 1NF 或 2NF - mysql

标签 mysql database-design normalization database-schema

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

enter image description here

我已尽力删除冗余数据。看来“Prof_Dept”中仍然存在冗余数据

最佳答案

架构看起来很奇怪。 Professor_Dept 的子级(其中包含 Professor_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

从一门类(class)中,您已经通过 FK 知道它与哪位教授和部门相关。

关于mysql - 将数据库设置为 1NF 或 2NF - mysql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5372258/

相关文章:

sql - 在 SQL 中使用可变模式持久化复杂类型的最有效方法

php - 需要建议来更改我的数据库设计

unicode - Unicode 中是否存在每个 "character"只是一个代码点的编码?

mysql - 将重要的 opencart 表移动到另一个数据库

mysql - WHERE 日期时间早于某个时间(例如 15 分钟)

mysql - 编写一条 SQL 语句进行速度跟踪

database-design - NoSQL(Redis)设计建议

c - 标准化给定 .txt 文件中字母的频率

MySQL规范化存储过程性能

php - PHP 中的 mysql 查询返回 0 个结果