Cypher

aggregation

Grouping rows and computing a value over each group. In Cypher the grouping keys are whatever expressions in the same clause are not aggregated.

Example

One row per person, counting the films each acted in.

cypher
MATCH (p:Person)-[:ACTED_IN]->(m:Movie)
RETURN p.name, count(m) AS films

count(m) is the aggregate. p.name is the only other expression in the clause, so it is the grouping key. Adding m.year beside it would group by person and year instead, and return a row for each.

Lessons that use this term

The lesson and course links below open in a new tab.

No published lesson uses this term yet.

All glossary terms