clear markdown compare help best fiddles feedback dbanow.uk a leap of faith?
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 921263 fiddles created (11963 in the last week).

CREATE TABLE bool_test( id INT AUTO_INCREMENT PRIMARY KEY, bool_val BOOL CHECK(bool_val IN(TRUE,FALSE)) );
 hidden batch(es)


insert into bool_test(bool_val) values (0);
 hidden batch(es)


insert into bool_test(bool_val) values (0x00);
 hidden batch(es)


insert into bool_test(bool_val) values (1);
 hidden batch(es)


insert into bool_test(bool_val) values ('1');
 hidden batch(es)


insert into bool_test(bool_val) values (true);
 hidden batch(es)


insert into bool_test(bool_val) values (null);
 hidden batch(es)


insert into bool_test(bool_val) values (2);
Check constraint 'bool_test_chk_1' is violated.
 hidden batch(es)


insert into bool_test(bool_val) values (-1);
Check constraint 'bool_test_chk_1' is violated.
 hidden batch(es)


select * from bool_test
id bool_val
1 0
2 0
3 1
4 1
5 1
6
 hidden batch(es)


show create table bool_test
Table Create Table
bool_test CREATE TABLE `bool_test` ( `id` int NOT NULL AUTO_INCREMENT, `bool_val` tinyint(1) DEFAULT NULL, PRIMARY KEY (`id`), CONSTRAINT `bool_test_chk_1` CHECK ((`bool_val` in (true,false))) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
 hidden batch(es)