I have created a table in MySQL as
create table bittest (id int(11),constant bit(1) default b'0' );
Then,
insert into bittest(id) values (1);
select query get printed as
+------+----------+
| id | constant |
+------+----------+
| 1 | |
+------+----------+
1 row in set (0.00 sec)
Clearly value of constant is not shown as bit.
And when I do export using mysqldump insert statement gets exported as
INSERT INTO `bittest2` VALUES (1,'\0');
which is causing issues as I don't want null values inserted.
Is there a work around for this? MySQL version 5.7.13

\0is notnull. I'm not sure why the linked question doesn't answer your question, butb'0'is the same as\0(all bits in\0are 0, it's just not 8 bits as you usually think of when you see\0). A bit is not an integer, and if you reimport it (with yourinsert) is will work fine. It would actually work with 0, too, because it will cast it correctly, but bits are just not integers. If you want to have an integer, use one, e.g.tinyint(1), or its synonymbool. (mysql used to usetinyintforbitsome versions ago, but changed it to be more standard compliant).