SETEQ 연산자는 첫 번째 피연산자와 두 번째 피연산자가 동일한 경우 TRUE(1)을 반환한다. 모든 집합형 데이터 타입에 대해 비교 연산을 수행할 수 있다.
collection_operand SETEQ collection_operand
--creating a table with SET type address column and LIST type zip_code column
CREATE TABLE contain_tbl (id int primary key, name char(10), address SET varchar(20), zip_code LIST int);
INSERT INTO contain_tbl VALUES(1, 'Kim', {'country', 'state'},{1, 2, 3});
INSERT INTO contain_tbl VALUES(2, 'Moy', {'country', 'state'},{3, 2, 1});
INSERT INTO contain_tbl VALUES(3, 'Jones', {'country', 'state', 'city'},{1,2,3,4});
INSERT INTO contain_tbl VALUES(4, 'Smith', {'country', 'state', 'city', 'street'},{1,2,3,4});
INSERT INTO contain_tbl VALUES(5, 'Kim', {'country', 'state', 'city', 'street'},{1,2,3,4});
INSERT INTO contain_tbl VALUES(6, 'Smith', {'country', 'state', 'city', 'street'},{1,2,3,5});
INSERT INTO contain_tbl VALUES(7, 'Brown', {'country', 'state', 'city', 'street'},{});
--selecting rows when two collection_operands are same in the WEHRE clause
SELECT id, name, address, zip_code FROM contain_tbl WHERE address SETEQ {'country','state', 'city'};
=== <Result of SELECT Command in Line 1> ===
id name address zip_code
===============================================================================
3 'Jones ' {'city', 'country', 'state'} {1, 2, 3, 4}
1 row selected.
--selecting rows when two collection_operands are same in the WEHRE clause
SELECT id, name, address, zip_code FROM contain_tbl WHERE zip_code SETEQ {1,2,3};
=== <Result of SELECT Command in Line 1> ===
id name address zip_code
===============================================================================
1 'Kim ' {'country', 'state'} {1, 2, 3}
1 rows selected.