I am using PHPMyAdmin to set up some MySQL tables for the first time, and don’t see a Boolean data type. How do I set up True/False fields? I see a BOOL data type, but that won’t accept a default value of ‘False’.
Robert
I am using PHPMyAdmin to set up some MySQL tables for the first time, and don’t see a Boolean data type. How do I set up True/False fields? I see a BOOL data type, but that won’t accept a default value of ‘False’.
Robert
mysql doesn’t have a boolean data type. The best you can do is to use a tinyint.
felgall is absolutely correct, mysql doesn’t have a boolean data type. I am using a mysql editor named SQLyog which shows a boolean data type but when i assign any field as boolean, It converts it to tinyint.
Also if you cannot assign “false” as a default value, you can use 0 or 1 if it fits your requirement.
a word of advice about boolean columns: often it is better to set up an actual domain (i.e. range of valid values)
for example, consider the boolean column isMarried
you would think that the values True and False would be okay, but they often are insufficient – how do you represent someone who is divorced?
better would be a column called MaritalStatus, and you can give it values like 0=single, 1=married, 2=divorced, 3=widowed