正常化的性别表是否太远? [英] Is normalizing the gender table going too far?

查看:94
本文介绍了正常化的性别表是否太远?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不是数据库的家伙,但我试图清理另一个数据库。所以我的问题是正常化的性别表是太远吗?

I am not a database guy, but am trying to clean up another database. So my question is would normalizing the gender table be going too far?

User table:
userid int pk,
genderid char(1) fk
etc...

gender table:
genderid char(1) pk,
gender varchar(20)

现在开始对我来说似乎很蠢,但后来我考虑了,因为我可以有一个不变的数据源填充或绑定。我将使用WPF。如果它是另一个框架,我可能会避免它,但你怎么想?

Now at first it seemed silly to me, but then I considered it because i can then have a constant data source to populate from or bind from. I will be using WPF. If it was another framework I would probably avoid it, but what do you think?

推荐答案

如果符合以下条件,我将规范化:

I would normalize if:


  • 您希望能够在数据库中管理性别的描述,而不是在代码中。


    • 这样可以快速将描述从男性/女性更改为男性/女性。

    如果:

      >
    • 您有一个相对简单的应用程序,您可以在代码中而不是在数据库中轻松管理性别的描述。

    • 您对程序控制

    • 您只需关心性别字段中的数据,即可确保该字段中数据的一致性。 / em>字段用于信息捕获,这意味着,一旦第一次设置,您就没有很多程序化更新此字段。

    • You have a relatively simple application where you can easily manage the description of the gender in code rather than in the database.
    • You have tight programmatic control of the data going in and out of the gender field such that you can ensure consistency of the data in that field.
    • You only care about the gender field for information capture, meaning, you don't have a lot of programmatic need to update this field once it is set the first time.

    这篇关于正常化的性别表是否太远?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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