REST from your database catalog
    DocumentationCheat sheetQuestionsDownloadSource
    Questions
    • How do I...?
    Start here
    • Getting started
    • What a table becomes
    • Compared with PostgREST
    Setting up
    • Tables, columns and relations
    • Security and hooks
    • Writes and procedures
    • Prefer: return=representation
    • Node, Fastify, Express
    Reading
    • select
    • /{key}
    • relation(...)
    • order
    • limit, offset
    • relation.order, .limit
    • count
    • count(), sum(), avg()...
    • "name"
    Filtering
    • eq, neq
    • gt, gte, lt, lte
    • in
    • like, ilike
    • match, imatch
    • is
    • ov, cs, cd
    • not
    • relation.column
    • or, and
    Databases
    • Supported databases
    • Adding a database
    Reference
    • Cheat sheet
    • Errors
    Reading

    Totals per group

    Put aggregates in select; the plain columns beside them become the groups.

    select=count()select=status,count()select=status,estimate.sum(),created_at.min()

    count() counts the rows. column.sum() and column.avg() take numbers; column.min() and column.max() anything that can be sorted, dates included.

    Every plain column you select splits the rows into groups, one answer row per group. A grouped read cannot embed relations, and orders by its selected columns only.

    Examples

    How many todos in all.
    /todos?select=count()

    Asking the database...

    Per status: how many, the average estimate, and the oldest creation date.
    /todos?select=status,count(),estimate.avg(),created_at.min()&order=status

    Asking the database...

    See alsoKnow how many there are
    PreviousKnow how many there areNext Names that are keywords
    restloom - a REST API generated from your database catalog
    DocumentationDownloadSource