MySQL doesn't define a distinct boolean data type, opting instead to make BOOL and BOOLEAN aliases for TINYINT(1). Why is this so?
+1
A:
If I understand your question correctly, it's because Boolean values in MySql are just constants aliased to 1 or 0, and depend on the underlying type being used.
Reed Copsey
2010-03-06 01:58:36
This does not explain *why*.
ewernli
2010-03-06 10:08:19
+1
A:
A boolean data type simply maps to a 1-bit tiny integer. You can find out more here: http://dev.mysql.com/doc/refman/5.0/en/numeric-type-overview.html
BrainCore
2010-03-06 01:59:09
This does not explain *why*. In the link I read "We intend to implement full boolean type handling, in accordance with standard SQL, in a future MySQL release." What would be the advantage? Why hasn't it been done?
ewernli
2010-03-06 10:06:50
+1
A:
It's because the SQL specification didn't define one until SQL:1999 and it's not enforced. MySQL's ahead of most of the pack just for allowing the keyword - MSSQL, DB2, and Oracle use BIT and some true/false constants to fake it.
(Basically it's for the same reason that, although the SQL spec states it's pronounced "ess queue ell," everyone I know just says "sequel" because we're lazy & understand the context.)
tadamson
2010-03-06 04:26:22