Skip to main content Link Menu Expand (external link) Document Search Copy Copied

SETCONTAINSALL() function

SETCONTAINSALL() returns True when all specified values are found within an IDSET or STRINGSET column.

Syntax

SETCONTAINSALL(
  {idset-column, [int-value,...]} |
  {stringset-column, ['string-value',...]}
  )

Arguments

Argument Description Data type
idset-column Source column of idset data type  
int-value One or more integer values to search for within the idset-column  
stringset-column Source column of idset data type  
'stringset-value' One or more string values contained in single quotes to search for within the idset-column  
[ ] Required square brackets  

Returns

Column contains Data type Result
All specified values Boolean True

Examples

Segments table

create table segments
    (_id id, segment stringset);
insert into segments(_id, segment)
    values (1, ['RED', 'BLUE', 'GREEN']);

+-----+------------------+
| _id | segment          |
+-----+------------------+
|   1 | [RED BLUE GREEN] |
+-----+------------------+

Testing set membership in the select list

This query returns true.

select setcontainsall(segment, ['BLUE', 'RED']) as HasBlueOrRed  
    from segments;  

Testing set membership as a where clause filter

This query returns true.

select _id, segment from segments where setcontainsall(segment, ['BLUE', 'RED']);