mysql 位操作
2012-05-08 17:40
169 查看
Bitwise OR:
mysql> SELECT 29 | 15;
-> 31
The result is an unsigned 64-bit integer.
&
Bitwise AND:
mysql> SELECT 29 & 15;
-> 13
The result is an unsigned 64-bit integer.
^
Bitwise XOR:
mysql> SELECT 1 ^ 1;
-> 0
mysql> SELECT 1 ^ 0;
-> 1
mysql> SELECT 11 ^ 3;
-> 8
The result is an unsigned 64-bit integer.
<<
Shifts a longlong (BIGINT) number to the left.
mysql> SELECT 1 << 2;
-> 4
The result is an unsigned 64-bit integer.
>>
Shifts a longlong (BIGINT) number to the right.
mysql> SELECT 4 >> 2;
-> 1
The result is an unsigned 64-bit integer.
~
Invert all bits.
mysql> SELECT 5 & ~1;
-> 4
The result is an unsigned 64-bit integer.
BIT_COUNT(N)
Returns the number of bits that are set in the argument N.
mysql> SELECT BIT_COUNT(29);
-> 4
mysql> SELECT 29 | 15;
-> 31
The result is an unsigned 64-bit integer.
&
Bitwise AND:
mysql> SELECT 29 & 15;
-> 13
The result is an unsigned 64-bit integer.
^
Bitwise XOR:
mysql> SELECT 1 ^ 1;
-> 0
mysql> SELECT 1 ^ 0;
-> 1
mysql> SELECT 11 ^ 3;
-> 8
The result is an unsigned 64-bit integer.
<<
Shifts a longlong (BIGINT) number to the left.
mysql> SELECT 1 << 2;
-> 4
The result is an unsigned 64-bit integer.
>>
Shifts a longlong (BIGINT) number to the right.
mysql> SELECT 4 >> 2;
-> 1
The result is an unsigned 64-bit integer.
~
Invert all bits.
mysql> SELECT 5 & ~1;
-> 4
The result is an unsigned 64-bit integer.
BIT_COUNT(N)
Returns the number of bits that are set in the argument N.
mysql> SELECT BIT_COUNT(29);
-> 4
相关文章推荐
- mysql 的相关位操作
- mysql 位操作支持
- MySQL中文乱码问题的解决第1/2页
- MYSQL安装+Mysql-front 注册码
- MySQL中使用Function和Procedure---持续更新
- How to use perl to connect MySQL?(利用Perl连接MySQL)
- mysql 存在更新 不存在插入
- mysql中分组查询的问题
- MySQL服务器学习笔记!(四) ——备份/恢复
- 自解压MYSQL安全
- mysql忘记密码,如何重置密码
- 使用Hibernate映射技术将Mysql数据复制到Oracle数据库
- mysql集群配置
- mysql 对表、列的增删改
- [转]mysql如何设置主键和外键,实现级联更新、级联删除
- 关于MYSQL中每个用户取1条记录的三种写法(group by xxx)
- 算法:将table标识的树形结构文本数据快速导入Mysql邻接表
- msmql与mysql的区别
- mysql中查询条件字段为空的查询
- mysql_replace_替换数据