I don't want to touch-off a religious war here, but there seem to be two schools of thoughts in how to represent boolean values in a database. Some say bit
is the appropriate data type, while others argue tinyint
is better.
The only differences I'm aware of are these:
bit
: storage size is 1 bit, possible values are 0 or 1
tinyint
: storage size is 1 byte, possible values are 0-255
Which data type is better when you need to represent boolean values? Is tinyint
worth the extra overhead "just in case" you need to values > 1?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…