MySQL 中的 BIT 和 TINYINT 有什么区别?

2021-11-20 00:00:00 bit mysql tinyint

在哪些情况下您会使用哪个?有很大区别吗?我通常被持久化引擎用来存储布尔值?

In which cases would you use which? Is there much of a difference? Which I typically used by persistence engines to store booleans?

推荐答案

TINYINT 是一个 8 位整数值,一个 BIT 字段可以存储 1 位 BIT(1) 和 64 位 BIT(64).对于布尔值,BIT(1) 很常见.

A TINYINT is an 8-bit integer value, a BIT field can store between 1 bit, BIT(1), and 64 bits, BIT(64). For a boolean values, BIT(1) is pretty common.

相关文章