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?

2 Answers 2

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

Sign up to request clarification or add additional context in comments.

1 Comment

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.