What is the difference between TINYINT(1) and Boolean in MySQL?


There is no difference between TINYINT(1) and Boolean. The keyword Bool or Boolean internally converts into TINYINT(1) or we can say Bool or Boolean are synonymous with TINYINT(1).

Let us first create a table −

mysql> create table DemoTable
(
   isMarried Boolean
);
Query OK, 0 rows affected (1.77 sec)

Let us check the description of the table −

mysql> desc DemoTable;

This will produce the following output −

+-----------+------------+------+-----+---------+-------+
| Field     | Type       | Null | Key | Default | Extra |
+-----------+------------+------+-----+---------+-------+
| isMarried | tinyint(1) | YES  |     | NULL    |       |
+-----------+------------+------+-----+---------+-------+
1 row in set (0.01 sec)

Insert some records in the table using insert command −

mysql> insert into DemoTable values(true);
Query OK, 1 row affected (0.30 sec)
mysql> insert into DemoTable values(false);
Query OK, 1 row affected (0.16 sec)

Display all records from the table using select statement −

mysql> select *from DemoTable;

This will produce the following output −

+-----------+
| isMarried |
+-----------+
|         1 |
|         0 |
+-----------+
2 rows in set (0.00 sec)

Updated on: 01-Oct-2019

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements