Showing posts with label Difference between BOOL BIT and TINYINT in MySQL?. Show all posts
Showing posts with label Difference between BOOL BIT and TINYINT in MySQL?. Show all posts
Difference between BOOL BIT and TINYINT in MySQL?
Posted by Raj
Difference between BOOL BIT and TINYINT in MySQL?
BOOL:
BOOL is used to store Boolean values (0 and 1)
0 being false and 1 being true.
TINYINT:
- A TINYINT is an 8-bit integer value
- A very small integer value. (range is -128 to 127) and unsigned range is 0 to 255 occupies 1 byte.
BIT:
- A BIT field can store between 1 to 64 bits [ BIT(N)] (N indicates the number of bits per value, from 1 to 64)
- BIT data type can be used only for binary data.
- BIT data type can store up to 8 bytes.
Prior to MySQL 5.0.3: BOOL, BIT and TINYINT are all synonyms.After MySQL 5.0.3: BIT data type can store 8 bytes of data and should be used for binary data.
BOOL:
BOOL is used to store Boolean values (0 and 1)
0 being false and 1 being true.
TINYINT:
- A TINYINT is an 8-bit integer value
- A very small integer value. (range is -128 to 127) and unsigned range is 0 to 255 occupies 1 byte.
BIT:
- A BIT field can store between 1 to 64 bits [ BIT(N)] (N indicates the number of bits per value, from 1 to 64)
- BIT data type can be used only for binary data.
- BIT data type can store up to 8 bytes.
Prior to MySQL 5.0.3: BOOL, BIT and TINYINT are all synonyms.After MySQL 5.0.3: BIT data type can store 8 bytes of data and should be used for binary data.
