MySQL bit arithmetic

Source: Internet
Author: User
1, MOD (X1,X2) to find the remainder operation, the return residue with "%" 2, X1 DIV X2  Division operation returned quotient, with "/" 3, if the divisor is 0, then the result is null. 4, <=> and = are the same and are used to determine whether the operands are equal. The difference is that <=> can be used to judge that null,= cannot judge Null. Example: Select Null<=>null result 1  logical operator 1, with && OR and: All operands are not 0 and not NULL, the result is 1, any one operand is 0, the result is 0, There is an operand of null and no operand is 0 o'clock, and the result returns NULL. Example: A, -1&&2&&3 result is 1  B, 0&&3 result is 0  C, 0&&null result is 0 d, 3&&null result null2, or | | Or an OR example: A, 1| | -1| | null| | 0 Results 1 B, 3| | Null Results 1 C, 0| | Null result null D, null| | Null result null E, 0| | 0 Results 03, non! or not: A,!null result Null4, XOR, XOR: The same is 0 different from 1, where any one of the operands is NULL results return NULL. All numbers in MySQL that are greater than 1 and less than 1 are considered logical 0, and the other numbers are considered logical 1. Example: A, NULL XOR 1 result null B, null XOR 0 result null C, 3 XOR 1 result 0 d, 1 XOR 0 result 1 E, 0 xor 0 result 0 F, 3 xo R 0 Result 1  -bit operator & Bitwise AND | bitwise OR ~ bitwise negation ^ Bitwise XOR or << bitwise left SHIFT >> bitwise RIGHT SHIFT operation will first turn the operand into a binary number, then perform bit operations, and then change the result from the binary number back to the decimal number. NOTE: The bitwise operator must be decimal, and if it is binary, octal, and so on, you need to convert the operand to decimal by using the conv () function. To perform the corresponding bitwise operation.

MySQL bit arithmetic

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.