Mastering MySQL 4 [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Mastering MySQL 4 [Electronic resources] - نسخه متنی

Ian Gilfillan

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید







Bit Operators

The bit operators are not used often. They allow you to work with bit values and perform bit calculations in your queries.


&


value1 & value2

Performs a bitwise AND. This converts the values to binary and compares the bits. Only if both of the corresponding bits are 1 is the resulting bit also 1.

For example:

mysql> SELECT 2&1;
+-----+
| 2&1 |
+-----+
| 0 |
+-----+
mysql> SELECT 3&1;
+-----+
| 3&1 |
+-----+
| 1 |
+-----+



|


value1 | value2

Performs a bitwise OR. This converts the values to binary and compares the bits. If either of the corresponding bits are 1, the resulting bit is also 1.

For example:

mysql> SELECT 2|1;
+-----+
| 2|1 |
+-----+
| 3 |
+-----+



<<


value1 << value2

Converts value1 to binary and shifts the bits of value1 left by the amount of value2.

For example:

mysql> SELECT 2<<1;
+------+
| 2<<1 |
+------+
| 4 |
+------+



>>


value1 >> value2

Converts value1 to binary and shifts the bits of value1 right by the amount of value2.

For example:

mysql> SELECT 2>>1;
+------+
| 2>>1 |
+------+
| 1 |
+------+



/ 229