gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 14:52:55 25 4
gpt4 key购买 nike

如何以更好的 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com