Bit or : Bit « Function « SQL / MySQL






Bit or

     
mysql>
mysql>
mysql> CREATE TABLE BITS (BIN_VALUE INTEGER NOT NULL PRIMARY KEY);
Query OK, 0 rows affected (0.00 sec)

mysql> INSERT INTO BITS VALUES
    -> (CONV(001,2,16)),
    -> (CONV(011,2,16)),
    -> (CONV(111,2,16));
Query OK, 3 rows affected (0.00 sec)
Records: 3  Duplicates: 0  Warnings: 0

mysql>
mysql>
mysql>
mysql> SELECT   BIN(BIT_OR(BIN_VALUE))
    -> FROM     BITS;
+------------------------+
| BIN(BIT_OR(BIN_VALUE)) |
+------------------------+
| 111                    |
+------------------------+
1 row in set (0.00 sec)

mysql>
mysql> drop table bits;
Query OK, 0 rows affected (0.00 sec)

   
    
    
    
    
  








Related examples in the same category

1.UPDATE statement moves each bit to the left one position:
2.left shift operator
3.The >> is the right shift operator
4.Bitwise operators
5.Bit Operators
6.Bit operation
7.Left shift
8.Left shift 3
9.The result of a bitwise AND between 7 and 9 is 1
10.Shifting beyond 64 bits, or with a negative number, just returns 0.
11.Move the binary value 11 three bits to the left.
12.Apply several binary operators to the columns of the MATCHES table.