BOOLEAN
Synonym for TINYINT(1). Like BOOL, this type is used for boolean logic, storing 0 for false and 1 (or other non-zero numbers) for true.
Syntax
BOOL, BOOLEANDescription
These types are synonyms for TINYINT(1). A value of zero is considered false. Non-zero values are considered true.
However, the values TRUE and FALSE are merely aliases for 1 and 0. See Boolean Literals, as well as the IS operator for testing values against a boolean.
Examples
CREATE TABLE boolean_example (
example BOOLEAN
);SHOW CREATE TABLE boolean_example\G*************************** 1. row ***************************
Table: boolean_example
Create Table: CREATE TABLE `boolean_example` (
`example` tinyint(1) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1CREATE TABLE boo (i BOOLEAN);
DESC boo;
+-------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+------------+------+-----+---------+-------+
| i | tinyint(1) | YES | | NULL | |
+-------+------------+------+-----+---------+-------+TRUE and FALSE as aliases for 1 and 0:
The last two statements display the results shown because 2 is equal to neither 1 nor 0.
See Also
This page is licensed: GPLv2, originally from fill_help_tables.sql
Last updated
Was this helpful?

