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

后端 未结 4 1455
感情败类
感情败类 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 03:00

    The tinyint data type utilizes 1 byte of storage. 256 possible integer values can be stored using 1 byte (-128 through 127). if you define as tinyint unsigned then negative values are discarded so is possible to store (0 through 255).

提交回复
热议问题