PolarDB-X支援的标量位函數
函數名 | 描述 |
| | 按位或 |
^ | 按位異或 |
& | 按位與 |
BIT_COUNT() | 統計二進制數中1的個數 |
PolarDB-X支援的聚合位函數
| |
BIT_OR() | |
BIT_XOR() | |
BIT_AND() | |
示例
BIT_COUNT()傳回參數對應的二進制數中1的個數;若參數為NULL,則傳回NULL。
mysql> SELECT BIT_COUNT(29), BIT_COUNT(b'101010');
+--------------+----------------------+
| BIT_COUNT(29) | BIT_COUNT(b'101010') |
+--------------+----------------------+
| 4 | 3 |
+--------------+----------------------+
1 row in set (0.00 sec)
mysql> SELECT BIT_COUNT(NULL);
+-----------------+
| BIT_COUNT(NULL) |
+-----------------+
| NULL |
+-----------------+
1 row in set (0.00 sec)
mysql> SELECT 3 & 2;
+-------+
| 3 & 2 |
+-------+
| 2 |
+-------+
1 row in set (0.01 sec)