单列表是好的设计吗? [英] Is a one column table good design?

查看:22
本文介绍了单列表是好的设计吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一张只有一列的表格可以吗?我知道这在技术上并不违法,但它被认为是糟糕的设计吗?

It it ok to have a table with just one column? I know it isn't technically illegal, but is it considered poor design?

这里有几个例子:

  • 您有一个包含 50 个有效美国州代码的表格,但您无需存储详细的州名.
  • 电子邮件黑名单.

有人提到添加关键字段.在我看来,这一列应该是主键.

Someone mentioned adding a key field. The way I see it, this single column WOULD be the primary key.

推荐答案

是的,以最高效的方式设计表格无疑是一种很好的设计.糟糕的 RDBMS 设计"通常以低效率为中心.

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屋!

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