MySQL Boolean “tinyint(1)” holds values up to 127?

后端 未结 4 1470
感情败类
感情败类 2020-12-05 02:32

I wanted to make a true/false field for if an item is in stock.

I wanted to set it to Boolean ( which gets converted to tinyint(1) ), 1 for in stock, 0

4条回答
  •  执念已碎
    2020-12-05 02:39

    See here for how MySQL handles this. If you use MySQL > 5.0.5 you can use BIT as data type (in older versions BIT will be interpreted as TINYINT(1). However, the (1)-part is just the display width, not the internal length.

提交回复
热议问题