SETNEQ 연산자

설명

SETNEQ 연산자는 첫 번째 피연산자와 두 번째 피연산자가 동일하지 않은 경우에 TRUE(1)을 반환한다. 모든 집합형 데이터 타입에 대해 비교 연산을 수행할 수 있다.

구문

collection_operand SETNEQ collection_operand

예제

--selecting rows when two collection_operands are not same in the WEHRE clause

SELECT id, name, address, zip_code FROM contain_tbl WHERE address SETNEQ {'country','state', 'city'};

           id  name                  address               zip_code

===============================================================================

            1  'Kim       '          {'country', 'state'}  {1, 2, 3}

            2  'Moy       '          {'country', 'state'}  {3, 2, 1}

            4  'Smith     '          {'city', 'country', 'state', 'street'}  {1, 2, 3, 4}

            5  'Kim       '          {'city', 'country', 'state', 'street'}  {1, 2, 3, 4}

            6  'Smith     '          {'city', 'country', 'state', 'street'}  {1, 2, 3, 5}

            7  'Brown     '          {'city', 'country', 'state', 'street'}  {} 

 

6 rows selected.

 

--selecting rows when two collection_operands are not same in the WEHRE clause

SELECT id, name, address, zip_code FROM contain_tbl WHERE zip_code SETNEQ {1,2,3};

           id  name                  address               zip_code

===============================================================================

            2  'Moy       '          {'country', 'state'}  {3, 2, 1}

            3  'Jones     '          {'city', 'country', 'state'}  {1, 2, 3, 4}

            4  'Smith     '          {'city', 'country', 'state', 'street'}  {1, 2, 3, 4}

            5  'Kim       '          {'city', 'country', 'state', 'street'}  {1, 2, 3, 4}

            6  'Smith     '          {'city', 'country', 'state', 'street'}  {1, 2, 3, 5}

            7  'Brown     '          {'city', 'country', 'state', 'street'}  {}