mysql里concat函数和 ‘’|‘’ 符号一起用是表示什么?
PHPz
PHPz 2017-04-17 15:35:51
0
1
1499

比如像这种:concat(t4.name,t4.pinyin,t1.trader)|t4.name

PHPz
PHPz

学习是最好的投资!

reply all(1)
Peter_Zhu

concat is the mysql splicing function.

"|" means bitwise OR. When performing a bitwise OR operation, the database system will first convert the decimal operands into binary numbers, and then perform a logical OR operation on the corresponding binary numbers bit by bit. If one or two of the corresponding binary bits are 1, the operation result of the bit is 1; otherwise, when the corresponding binary bit has two 0s, the operation result of the bit is 0.

Example
uses the bitwise OR operator "|" to perform operations. The SQL code is as follows:

mysql>SELECT 10|15,9|4|2;
As shown below:

The operation effect of using the bitwise OR operator "|"

The binary value of 10 is 1010, and the binary value of 15 is 1111. After bitwise OR operation, the result is 1111, and then the binary number 1111 is converted into a decimal number, which is the integer 15;

The binary value of 9 is 1001, the binary value of 4 is 0100, and the binary value of 2 is 0010. After bitwise OR operation (first perform bitwise OR operation on 9 and 4, we get 1101, and then press it with 2 Bitwise OR operation, resulting in 1111), the result is 1111, and then the binary number 1111 is converted into a decimal number, which is the integer 15.

Content excerpted from: http://www.baike369.com/conte...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!