Is there a logical data type in MySQL, like Access, for a radio switch or a check mark?
- 2And BIT than not happy? - megacoder
- BIT (1) will occupy 1 byte? - root_x Povierennyy
|
3 answers
In fact, there is no such type.
Even doing:
ALTER TABLE `table` CHANGE `bool` `bool` BOOLEAN NOT NULL
The field type will be TINYINT (1).
Note: when processing a request, for any field type, true and false are automatically replaced with 1 and 0 .
( Select * from `a` where `b` = true ) == ( Select * from `a` where `b` = 1 )
- Well, yes, this is BOOLEAN, BOOL is type aliases. - culebre
|
And what do you excite people?
drop temporary table t1; create temporary table t1( f1 boolean -- тот же результат при TINYINT( 1 ) ) select 34 as f1 ; select * from t1 ;
- output = 34, not 1 or 0.
|
There is - BOOLEAN. Check:
Data types
- Why did I not find this on the off-dock? I wonder how much space does the BIT (1) data type take? I think it will be 8 bits, that is 1 byte. in this case, you can use TINYINT (1). Saving on bits will not work. (?) - root_x Povierennyy
|