What's the difference between MySQL BOOL and BOOLEAN column data types?

MysqlSqldatatypes

Mysql Problem Overview


I'm using MySQL version 5.1.49-1ubuntu8.1. It allows me to define columns of two different data types: BOOL and BOOLEAN. What are the differences between the two types?

Mysql Solutions


Solution 1 - Mysql

They are both synonyms for TINYINT(1).

Solution 2 - Mysql

As established in other comments, they're synonyms for TINYINT(1).

So, why do they bother differentiating between bool, boolean, tinyint(1)?

Mostly semantics.

Bool and Boolean: MySQL default converts these to the tinyint type. Per a MySQL statement made around the time of this writing, "We intend to implement full boolean type handling, in accordance with standard SQL, in a future MySQL release."

0 = FALSE 1 = TRUE

TINYINT: Occupies one byte; ranges from -128 to +127; or, 0 – 256.


Commonly brought up in this comparison: After MySQL 5.0.3 -- Bit: Uses 8 bytes and stores only binary data.

Solution 3 - Mysql

One thing I just noticed - with a column defined as BOOL in MySql, Spring Roo correctly generates Java code to unmarshall the value to a Boolean, so presumably specifying BOOL can add some value, even if it's only in the nature of a hint about the intended use of the column.

Solution 4 - Mysql

check the MySQL docs overview of numeric types:

http://dev.mysql.com/doc/refman/5.0/en/numeric-type-overview.html

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionikostiaView Question on Stackoverflow
Solution 1 - MysqlAdam PraxView Answer on Stackoverflow
Solution 2 - MysqlSixthforeView Answer on Stackoverflow
Solution 3 - MysqlSimonYView Answer on Stackoverflow
Solution 4 - MysqlgdpView Answer on Stackoverflow