I want to store a user's gender in a database with as little (size/performance) cost as possible.
So far, 3 scenarios come to mind
- Int - aligned with Enum in code (1 = Male, 2 = Female, 3 = ...)
- char(1) - Store m, f or another single character identifier
- Bit (boolean) - is there an appropriate field name for this option?
The reason I ask is because of this answer which mentions that chars are smaller than booleans.
I should clarify that I'm using MS SQL 2008, which DOES in fact have the bit datatype.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…