EdgeQL Tutorial

Aggregates

Subtopics

One of the simple, but powerful built-in functions is count. It's a function that takes a set of anything as its input and returns the number of elements in that set. Try counting all Content objects:

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

Since all values in EdgeDB can be compared to other values of the same type you can find a "minimum" and a "maximum" value by using min and max, respectively:

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

Another pair of useful functions is array_agg and array_unpack which convert a set to an array and vice versa, respectively. Try them out:

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.