您如何知道何时需要单独的表? [英] How do you know when you need separate tables?

查看:55
本文介绍了您如何知道何时需要单独的表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您如何知道何时为非常相似的对象类型创建新表?

How do you know when to create a new table for very similar object types?

示例:
为了学习mysql,我正在建立一个太阳系模型.在我的项目中,行星与矮行星,半人马座和彗星具有许多相似的属性.矮行星几乎与行星完全相同.半人马座和彗星与行星的区别仅在于它们的轨道路径具有更多的变化.对于每种类型的对象,我应该有一个单独的表,还是应该共享表?

Example:
To learn mysql I'm building a model solar system. For the purposes of my project, planets have many similar attributes to dwarf planets, centaurs, and comets. Dwarf planets are almost completely identical to planets. Centaurs and comets are only different from planets because their orbital path has more variation. Should I have a separate table for each type of object, or should they share tables?

该示例可能太简单了,但是我也对最佳实践感兴趣.就像我应该使用单独的表格一样,以防万一将来要使行星和矮行星不同,或者是出于效率考虑将它们保持在同一表格中.

The example is probably too simple, but I'm also interested in best practices. Like should I use separate tables just in case I want to make planets and dwarf planets different in the future, or are their any efficiency reasons for keeping them in the same table.

推荐答案

常规形式是您应该感兴趣的东西.它们几乎是建立表的惯例.

Normal forms is what you should be interested with. They pretty much are the convention for building tables.

任何不会破坏第一三次正常形式对我来说没问题.不过,这是一长串要求,所以我建议您从上面的Wikipedia链接中阅读它.

Any design that doesn't break the first, second or third normal form is fine by me. That's a pretty long list of requirement though, so I suggest you go read it off the Wikipedia links above.

这篇关于您如何知道何时需要单独的表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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