BOOL, BOOLEAN
BOOL
This data column type, BOOL, is synonymous
with BOOLEAN and TINYINT(1). In
fact, if you set a column to this type and then use the
DESCRIBE statement to see the description of the
column, it will show it as a TINYINT(1). It can be
useful for a simple logical column in which you want only a true or
false value. For example, if a column labeled
active was a BOOLEAN type, you
could do something like the following:
SELECT client_name AS 'Client', IF(active, 'Active', 'Inactive') AS Status FROM clients;
This statement will show each client name in the table with the
words Active or Inactive next to each name. This works
because the IF() function checks for a value
of 1 or 0 for the value given; it returns the second parameter given
if the value is 1, the third parameter if the value is 0.