MySQL/PHP 数据库规范化
我和一群同学一起工作,创建与 php 结合使用的关系型 mysql 数据库。
我们正在尝试标准化数据库,但意见不同。当标准化和创建组中的第二个新表时,我自己认为最佳实践是将外键留在现有表中,因为新表中的唯一标识符成为新的 PK。
该小组的其余成员已被教导/认为这应该以另一种方式实现,即留下主键。
是不是只要存在关系就可以完成工作,或者是一种方法比另一种方法更正确?
预先感谢
加里
Im working amongst a group of fellow students creating relational mysql database to be used in conjunction with php.
We are attempting to normalise the database and are differing in opinion. When normalising and creating a new table two of the group, myself included feel the best practice is for the foreign key to be left behind in the existing table as the unique identifier in the new table becomes the new PK.
The remainder of the group have been taught/feel this should be implemented the other way, i.e. the primary key is left behind.
Could it be the case as long as a relationship is present it will do the job, or is it the case one method is correct over the other.
Thanks in advance
Gary
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这取决于你在做什么。当您删除部分依赖项时,规则是:
如果您要删除传递依赖项,则:
This depends on what you are doing. When you are removing a partial dependency then the rule is:
If you are removing a Transitive dependency then: