Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 329
ikostia Avatar asked Jan 20 '11 23:01

ikostia


2 Answers

They are both synonyms for TINYINT(1).

like image 116
Adam Prax Avatar answered Oct 21 '22 09:10

Adam Prax


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

*So, why do they bother differentiating between bool, boolean, tiny*int(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.

like image 30
Sixthfore Avatar answered Oct 21 '22 10:10

Sixthfore