Is normalizing the gender table going too far?

前端 未结 7 1205
陌清茗
陌清茗 2021-02-08 14:32

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 in         


        
7条回答
  •  花落未央
    2021-02-08 15:01

    Whether or not you choose to normalize your table structure to accomodate gender is going to depend on the requirements of your application and your business requirements.

    I would normalize if:

    • You want to be able to manage the "description" of a gender in the database, and not in code.
      • This allows you to quickly change the description from Man/Woman to Male/Female, for example.
    • Your application currently must handle, or will possible handle in the future, localization requirements, i.e. being able to specify gender in different languages.
    • Your business requires that everything be normalized.

    I would not normalize if:

    • 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.

提交回复
热议问题