Aggregations

Aggregation queries provide summary-level results.

count()

ballerina
int activeCount = check db.'from(User)
    .'where({status: {equals: "ACTIVE"}})
    .count();

aggregate()

ballerina
var stats = check orm:'from(Order)
    .'where({status: {equals: "COMPLETED"}})
    .aggregate({
        sum: ["total"],
        avg: ["total"],
        min: ["total"],
        max: ["total"],
        count: ["id"]
    });

Next step

Continue with Select & Include.