标签:sele from incr tab bsp primary def auto engine
表结构
Table: t3 Create Table: CREATE TABLE `t3` ( `id` int(11) NOT NULL AUTO_INCREMENT, `bi` bit(8) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8
insert into t3 (bi) values (11);
对于bit类型,实际插入的是二进制数 1011
select bi+0 from t3;
执行结果
+------+ | bi+0 | +------+ | 11 | +------+
对于bit类型,查询数据的格式是 (字段+0)
select bin(bi+0),oct(bi+0),hex(bi+0) from t3;
执行结果
+-----------+-----------+-----------+ | bin(bi+0) | oct(bi+0) | hex(bi+0) | +-----------+-----------+-----------+ | 1011 | 13 | B | +-----------+-----------+-----------+
在insert时插入二进制数据的语法是 b‘value‘
insert into t3 (bi) values (b‘11‘)
select bi+0, bin(bi+0),oct(bi+0),hex(bi+0) from t3;
执行结果
+------+-----------+-----------+-----------+ | bi+0 | bin(bi+0) | oct(bi+0) | hex(bi+0) | +------+-----------+-----------+-----------+ | 11 | 1011 | 13 | B | | 3 | 11 | 3 | 3 | +------+-----------+-----------+-----------+
标签:sele from incr tab bsp primary def auto engine
原文地址:https://www.cnblogs.com/bibiafa/p/9205023.html