Sign up ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

From MySQL manual, it says:


These types are synonyms for TINYINT(1). A value of zero is considered false. Nonzero values are considered true:

I created a BOOLEAN column with 0 as the default value. Then I update the value to 2. Logically, I would expect MySQL to accept either 0 or 1 since it is a boolean. However, MySQL did not issue an error or prevent me from performing the update.

If BOOLEAN works exactly the same as TINYINT(1), does it make any difference whether I use TINYINT(1) or BOOLEAN?

share|improve this question
Those two are really synonyms, so you can use them interchangeably, AFAIK. You won't see any difference between them. (Personally, as I use PostgreSQL 99.9% of the time, I feel this being one of the most annoying 'features' of MySQL.) – dezso Nov 9 '12 at 10:57
@dezso sounds like a good answer to me (except perhaps the personal viewpoint). should post it :) – Derek Downey Nov 9 '12 at 14:30

3 Answers 3

up vote 5 down vote accepted

Those two are really synonyms, so you can use them interchangeably. You won't see any difference between them.

If you want to allow 0 and 1 only, you can still use the bit type.

share|improve this answer
lol, seems like they are inventing something for nothing then.. BIT is a bit complicated to use, maybe I will just stick to TINYINT then.. – Question Overflow Nov 10 '12 at 8:37
@QuestionOverflow Keep in mind that BIT is really a bit field that holds one to sixty-four bits compactly. – David Harkness Sep 23 '14 at 22:07

If you are working with other people (or you want to remind yourself), you can use the data type BOOLEAN to suggest that the data is only intended to take on a value of 1 or 0.

share|improve this answer

It seems to me there is indeed a difference.

In a table I'm using I have a column defined as a tinyint with an index on the column. When I invoke the following query "explain select * from table where column is true" it indicates that it's going to read all the rows in the table (the "possible_keys" and "ref" columns are null despite the "key" column showing the index).

Changing the query to "explain select * from table where column = 1" the index kicks in correctly, with "possible keys" and "ref" columns being assigned values and "rows" set to a much lower number.

I also tried replacing the "true" with "false" and the 1 with a 0 and got comparable results.

Taking it a step further I switched from a tinyint to an int and it made no difference.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.