I would like to add a column to the table which contains either of two values: 1 or 0.
What would be the smallest datatype to store the data in MySQL?
A TINYINT(1)
can contain numbers between -127
to 127
.
You can use bit(1)
http://dev.mysql.com/doc/refman/5.0/en/storage-requirements.html
BOOL is stored in MySQL as TINYINT which would take 1 full byte
http://dev.mysql.com/doc/refman/5.0/en/other-vendor-data-types.html
A bit(1) would normally also take 1-byte but if there are multiple bits in a single record, then they get stored in the same byte, up to 8 per byte.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With