If I'm understanding correctly, BIT
is extremely disk efficient. For my case, I know I will always only have three values which I'd like to treat like INT
s: 1
, 2
, & 3
.
Am I correct that b'00'
is 3
and different from b'0'
, 1
?
If I try to use INT
values for INSERT
VALUE
s and SELECT
WHERE
s, will mysql automatically cast as BIT
s in those queries?
insert into t (bits) values (b'11'); /* 3 = 2^1+2^0 */
insert into t (bits) values (b'10'); /* 2 = 2^1 */
insert into t (bits) values (b'1'); /* 1 = 2^0 */
Yes can insert INT
;