The SUBSET
row function takes two sets of the same data type and returns a Boolean true
if (and only if) the second set is a subset of the first set.
SUBSET
function is:
SUBSET(<set1>, <set2>)
where:
mdex:string-set
). For example, set1 can be a multi-assign string attribute.SUBSET(A, B)then the
SUBSET
result is true
if (and only if) B is a subset of A.{ }
indicates an empty set):
SUBSET({ }, { }) = TRUE SUBSET({ 1, 2, 3 }, { }) = TRUE SUBSET({ 1, 2 }, { 1, 2 }) = TRUE SUBSET({ 1, 2, 3 }, { 1, 2 }) = TRUE SUBSET({ 1, 3, 5 }, { 1, 2 }) = FALSE SUBSET({ 1, 2 }, { 'x', 'y', 'z' }) yields a checking error because the two sets are not of the same data type
Note that the empty set is always a subset of every other set (including the empty set).
SUBSET example
RETURN results AS SELECT WineID AS id, SUBSET(Body, Flavors) AS subAttrs FROM WineState WHERE WineID < 5 ORDER BY id
id subAttrs ------------- | 1 | true | | 2 | true | | 3 | false | | 4 | false | -------------
The results show that the Flavors set is a subset of the Body set in Records 1 and 2, but not in Records 3 and 4.