| General Information | |
| Operator | union |
| Syntax | expr union expr |
| Type | binary |
| Operand Types | set or bag |
| Result Type | set if both two operands are of type set, bag otherwise |
| Functions | returns the union of the two operands. |
| Expression Examples | |
| expression | result |
| set(1, 2) union set(2, 3) | set(1, 2, 3) |
| set(1, 2) union bag(2, 3) | bag(1, 2, 2, 3) |
| list(1, 2) union bag(2, 3) | raises an error |
| General Information | |
| Operator | intersect |
| Syntax | expr intersect expr |
| Type | binary |
| Operand Types | set or bag |
| Result Type | set if both two operands are of type set, bag otherwise |
| Functions | returns the intersection of the two operands. |
| Expression Examples | |
| expression | result |
| set(1, 2) intersect set(2, 3) | set(2) |
| set(1, 2) intersect bag(2, 3) | bag(2) |
| bag(1, 2, 2, 3) intersect bag(2, 3, 2) | bag(2, 2, 3) |
| list(1, 2) intersect bag(2, 3) | raises an error |
| General Information | |
| Operator | except |
| Syntax | expr except expr |
| Type | binary |
| Operand Types | set or bag |
| Result Type | set if both two operands are of type set, bag otherwise |
| Functions | returns the difference of the two operands. |
| Expression Examples | |
| expression | result |
| set(1, 2) except set(2, 3) | set(1) |
| set(1, 2) except bag(2, 3) | bag(1) |
| set(1, 2, 10) except bag(12) | bag(1, 2, 10) |
| list(1, 2) except bag(2, 3) | raises an error |
| General Information | |
| Operator | < |
| <= | |
| > | |
| >= | |
| Syntax | expr < expr |
| expr <= expr | |
| expr > expr | |
| expr >= expr | |
| Type | binary |
| Operand Types | set or bag |
| Result Type | boolean |
| Functions | coll1 < coll2 : returns true if and only if coll1 is included in coll2 but not equal to coll2 |
| coll1 > coll2 : returns true if and only if coll2 is included in coll1 and not equal to coll1 | |
| coll2 <= coll1 : returns true if and only if coll1 is included in coll2 or equal to coll2 | |
| coll1 >= coll2 : returns true if and only if coll2 is included in coll1 or equal to coll1 | |
| Expression Examples | |
| expression | result |
| set(1, 2) < set(2, 3) | false |
| set(1, 2) < set(2, 3, 1) | true |
| set(1, 2) < bag(2, 3, 1) | true |
| set(1, 2) <= bag(2, 1) | false |
| set(1, 2) >= bag(2, 1) | false |