최종 수정: 에
BITMAP_AND_NOT,BITMAP_ANDNOT
설명
두 BITMAP에 NOT 연산을 수행하고 결과를 반환합니다. 첫 번째 입력 매개변수를 base BITMAP, 두 번째 입력 매개변수를 exclude BITMAP이라고 합니다.
별칭
- BITMAP_ANDNOT
구문
BITMAP_AND_NOT(<bitmap1>, <bitmap2>)
매개변수
| 매개변수 | 설명 |
|---|---|
<bitmap1> | NOT 연산을 적용할 Base BITMAP |
<bitmap2> | NOT 연산을 적용할 Exclusion BITMAP |
반환 값
BITMAP을 반환합니다.
- 매개변수의 값이 NULL이면 NULL을 반환합니다.
예제
select bitmap_count(bitmap_and_not(bitmap_from_string('1,2,3'),bitmap_from_string('3,4,5'))) cnt;
+------+
| cnt |
+------+
| 2 |
+------+
select bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),bitmap_from_string('3,4,5'))) as cnt;
+------+
| cnt |
+------+
| 1,2 |
+------+
select bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),bitmap_empty())) cnt;
+-------+
| cnt |
+-------+
| 1,2,3 |
+-------+
select bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),NULL)) as res;
+------+
| res |
+------+
| NULL |
+------+