BOOL and tinyint (1) ... unsigned?

I read that the bool type in mysql is an alias of tinyint (1), so I have to use tinyint

My question is: Do I need to declare it without a sign, I mean, is it necessary?

purchased tinyint(1) unsigned not null DEFAULT 0, or purchased tinyint(1) not null DEFAULT 0, 
+8
mysql boolean
source share
2 answers

It is not necessary; Leave it signed. In fact, it does not matter - 0 and 1 are within acceptable values ​​for TINYINT , regardless of its signature.

But seriously, just declare it BOOL , it shows very clearly that this value is true or false.

+10
source share

It is not necessary to declare it unsigned, especially if you use it to store a boolean.

+3
source share

All Articles