我希望以尽可能少的(大小/性能)成本将用户的性别存储在数据库中.
到目前为止,我想到了三个场景
- Int - aligned with Enum in code (1 = Male, 2 = Female, 3 = ...)
- char(1) - Store 101, 102 or another single character identifier
- Bit (boolean) - is there an appropriate field name for this option?
我问这个问题的原因是因为这个answer提到chars比booleans是smaller.
我应该澄清一下,我使用的是MS SQL 2008,它实际上有位数据类型.