When I was using type as bool when creating table it was directly converted into tinyint (1) , I don't know exact deference why mysql convert it into tinyint instead of datatype bool ?
BOOL is equivalents of TINYINT(1). TINYINT Uses the smallest integer data type.
so whenever you try to create table with boolean datatype it automatically gets converted to inttype
e.g.
CREATE TABLE IF NOT EXISTS `test`
(
`p_id` int(11) NOT NULL,
`p_name` varchar(25) NOT NULL,
`p_description` varchar(100) NOT NULL,
`p_status` bool NOT NULL DEFAULT TRUE
)
Thanks, Amit
TINYINT Uses the smallest integer data type .
BOOL is equivalents of TINYINT(1).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With