Marco Marco - 1 year ago 91
SQL Question

BOOL and tinyint(1) ... unsigned?

i've read that the bool type in mysql is an alias of tinyint(1), therefore i should use tinyint

My question is the following:
Do i need to declare it unsigned, i mean, is it necessary ?

purchased tinyint(1) unsigned not null DEFAULT 0,


purchased tinyint(1) not null DEFAULT 0,


It's not necessary; leave it signed. In fact, it doesn't matter anyway — 0 and 1 are within the range of valid values for TINYINT regardless of its signedness.

But, seriously, just declare it a BOOL, it makes it very clear that it's a true-or-false value.