EdgeQL Tutorial

Sets

Subtopics

EdgeQL has a number of basic operators for sets. Two of these are union and distinct.

union simply merges two sets together. This may result in duplicate entries:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input

Operators can be used more than once in a single statement:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input

distinct gets rid of duplicate entries producing a proper set:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input

Sets cannot be elements of other sets in EdgeQL, making a nested syntax equivalent to a union. This is also consistent with the notion that everything is a set, including singleton literal values:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input
Input
Run
Output Objects
Press the 'Run' button to evaluate the input

We use ChatGPT with additional context from our documentation to answer your questions. Not all answers will be accurate. Please join our Discord if you need more help.