count(<expression> ) 计算<expression>中非空值的数量
count(*) 计算匹配的行数
sum() 计算所有值之和,空值将被丢弃
avg() 计算平均值
percentileDisc(0.0-1.0) 计算给定值在一个组中的百分位
percentileCount(0.0-1.0) 计算给定值在一个组中的百分位
stdev() 计算给定值在一个组中的标准偏差
stdevp() 计算给定值在一个组中的标准偏差
max() 计算最大值
min() 计算最小值
collect() 将值收集起来,返回一个列表
distinct 去重
//统计出下级节点的个数, count(*) 用来计算匹配的行, 而 count(<expression>) 用来计算非空值的数量
match (u)-[*]->(o)
where u.id = 1
return count(distinct o)
过滤聚合结果
//找出下级节点小于6个的节点
match (u)-[*]->(o) where u.id = 1
with u, count(distinct o) as total
where total<6
return u
// 在 collect 前排序, Collect 将所有的值收集起来放入一个列表,空值将被忽略
match (u)
with u
order by u.name desc limit 3
return collect(distinct u.name)
//限制路径搜索的分支
match (u)-->(o)
with u order by u.id desc limit 1
match p= (u)-->(o)
return p