What is the data type for boolean equivalent in mysql?
Thanks
Sri
data type in mysql for boolean
Make it a TINYINT and use 1 for TRUE and 0 for FALSE.
Since 0 will render FALSE and 1 TRUE, you can use it exactly as you would use a 'real' boolean.
how about enum('1','0') or enum('yes','no'). I'd say this more reflects the properties of boolean than a tinyint, which can also hold other values than 1, or 0.
The properties of boolean var is that you can check whether var is true or not and that you can use !var. So it's OK to use tinyint. And more: you can use any type for boolean, even varchar or text. The only advantage of tinyint is that it's one byte long.
[deleted]
The only advantage of an ENUM would be that it will throw an error when you try to insert anything other than 0 or 1, where a tinyint will accept anything from -127 to 127, or 0-255.
If that doesn't bother you, then a tinyint is better than enum because enum uses more space and resources.