开发者

MySQL: BOOLEAN (aka tinyint(1)) vs BIT

开发者 https://www.devze.com 2023-01-24 01:44 出处:网络
What is the dif开发者_如何学Pythonference between BIT and BOOLEAN?tinyint(1) is an integer type with a defined display width of 1. The BIT data type represents bit-field values which can have from 1 t

What is the dif开发者_如何学Pythonference between BIT and BOOLEAN?


tinyint(1) is an integer type with a defined display width of 1. The BIT data type represents bit-field values which can have from 1 to 64 bits.

The storage size of tinyint is always 1 byte while the storage size of BIT(n) is approximately INT((n+7)/8) bytes

You can write to a BIT field using a special notation e.g. b'1111', don't think you can use this with INT/TINYINT fields

0

精彩评论

暂无评论...
验证码 换一张
取 消