MySQL:SET 类型

标签 mysql set

我正在学习“(MySQL) - SET Type”,在Mysql中,我没看懂下面的语句: 链接:The SET Type .

MySQL stores SET values numerically, with the low-order bit of the stored value corresponding to the first set member. If you retrieve a SET value in a numeric context, the value retrieved has bits set corresponding to the set members that make up the column value.

正如他们所说的“数字”,我知道“幕后”有 2 列,1 列是 SET 成员,1 列是二进制系统后面的数值(1、2、4、8、16 等) ..).

我也没有得到这个声明:

If a number is stored into a SET column, the bits that are set in the binary representation of the number determine the set members in the column value. For a column specified as SET('a','b','c','d'), the members have the following decimal and binary values.

大局我不明白 SET 成员在什么值下存储在数据库中,如果有人可以帮助我,我会很高兴,谢谢大家,美好的一天。

最佳答案

SET数据类型值以整数形式存储,SET值('val1','val2'...)以位形式存储;可能有 64 个值 - 8 字节整数。

有一篇关于 SET 类型及其使用的文章 - How to edit values of SET data type .

关于MySQL:SET 类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13419653/

相关文章:

mysql - BookShelf or MySQL如何选择column1-column2作为别名

swift - 不再有 "set"的最后一个属性了吗?

python - 如何从集合中获取列表?

python - 作为字符串列表的集合的所有可能组合

java - 将 HashMap 添加到 TreeSet 的奇怪行为

php - MySQL PHP 锁表,在期望并发连接时有没有更好的解决方案

mysql - 如何将两个单独的文本连接到一个 - 从字符串中选择 - IN MySQL

php - 计算特定日期之间的选票

python - Scrapy爬取数据到mysql

c++ - 如何获取集合中某个位置的整数?