Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I use BIT(1) or BOOL?

Tags:

mysql

Mysql has two types that can hold boolean data, bit and bool. Bit(1) seems more logical, because that has to be 1 or 0, bool is, according to the specs, the same as saying tinyint(1)

like image 407
Malfist Avatar asked Oct 19 '25 01:10

Malfist


1 Answers

For keeping things semi-universal / portable across other database vendors, use BIT. MySQL's a step ahead of most servers by even allowing the BOOLEAN keyword.

See: Comparison of different SQL implementations

like image 163
tadamson Avatar answered Oct 21 '25 14:10

tadamson