EQL allows users to write sets directly in queries.
{<expr1> [,<expr2>]*}
where the curly braces enclose a comma-separated list of one or more expressions.{ 1, 4, 7, 10 }while this is a string set:
{ 'Red', 'White', 'Merlot', 'Chardonnay' }
{ x, y + z, 3 }
Note that EQL promotes integers to doubles in a set constructor as needed. Therefore, writing {1, 2}
results in an mdex:long-set
type while {1, 2.5}
results in an mdex:double-set
type.
Set constructor examples
SELECT
clause constructs a string-type set (named selectWines) that contains 'Red' and 'White' as its two elements. The selectWines set is then used in a HAVING
clause to limit the returned records to those have WineType assignments of either 'Red' or 'White'.
RETURN results AS SELECT {'Red', 'White'} AS selectWines, WineID AS idRec, WineType AS wines, Body AS bodyAttr FROM WineState HAVING wines IN selectWines ORDER BY idRec
WHERE
clause:
RETURN results AS SELECT WineID AS idRec, WineType AS wines, Body AS bodyAttr FROM WineState WHERE WineType IN {'Red', 'White'} ORDER BY idRec
Both queries would return only records with a WineType of 'Red' or 'White'.