Aggregates

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 Media objects:

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
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