2

MySQL doesn't define a distinct boolean data type, opting instead to make BOOL and BOOLEAN aliases for TINYINT(1). Why is this so?

Shog9
  • 156,901
  • 35
  • 231
  • 235

2 Answers2

6

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.)

See also: Comparison of different SQL implementations

Community
  • 1
  • 1
tadamson
  • 8,581
  • 1
  • 18
  • 9
  • Great link. It explains the real reason: endless discussions about how to deal with NULLs. More than 15 years later only PostgreSQL really supports it. How crazy is that for such a commonly-requested data type? – Nate Nov 03 '15 at 23:54
2

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
  • 554,122
  • 78
  • 1,158
  • 1,373