Manoj kumar saini
Manoj kumar saini

Reputation: 21

Why doesn't MySQL define a boolean data type?

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

Upvotes: 2

Views: 1706

Answers (2)

tadamson
tadamson

Reputation: 8851

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

Upvotes: 6

Reed Copsey
Reed Copsey

Reputation: 564433

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.

Upvotes: 2

Related Questions