一列表好设计吗? [英] Is a one column table good design?
问题描述
编辑:
一些例子:
- 您有一张表,其中包含50个有效的美国州代码,但您不需要存储详细的状态名称。
- 电子邮件黑名单。
有人提到添加一个键字段。我看到的方式,这个单列应该是主键。
是的,设计一个表当然是很好的设计以使其最有效率的方式。 坏RDBMS设计通常集中在效率低下。
但是,我发现大多数情况下单列设计都可以从额外的列中受益。例如,状态代码通常可以在第二列中列出完整状态名称。或黑名单可以有相关的笔记。但是,如果您的设计真的不需要这些信息,那么单列就可以了。
It it ok to have a table with just one column? I know it isn't technically illegal, but is it considered poor design?
EDIT:
Here are a few examples:
- You have a table with the 50 valid US state codes, but you have no need to store the verbose state names.
- An email blacklist.
Someone mentioned adding a key field. The way I see it, this single column WOULD be the primary key.
Yes, it's certainly good design to design a table in such a way as to make it most efficient. "Bad RDBMS Design" is usually centered around inefficiency.
However, I have found that most cases of single column design could benefit from an additional column. For example, State Codes can typically have the Full State name spelled out in a second column. Or a blacklist can have notes associated. But, if your design really does not need that information, then it's perfectly ok to have the single column.
这篇关于一列表好设计吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!