Cypher - Aggregation(聚合) group by

count(<expression> )       計算<expression>中非空值的數量
count(*)                             計算匹配的行數
sum()                                 計算全部值之和,空值將被丟棄
avg()                                  計算平均值
percentileDisc(0.0-1.0)  計算給定值在一個組中的百分位
percentileCount(0.0-1.0)    計算給定值在一個組中的百分位
stdev()                                計算給定值在一個組中的標準誤差
stdevp()                              計算給定值在一個組中的標準誤差
max()                                  計算最大值
min()                                   計算最小值
collect()                              將值收集起來,返回一個列表
distinct                               去重
 express

//統計出下級節點的個數, count(*) 用來計算匹配的, 而 count(<expression>) 用來計算非空值的數量spa

match (u)-[*]->(o)
 where u.id = 1
 return count(distinct o)
排序

過濾聚合結果it

//找出下級節點小於6個的節點io

match (u)-[*]->(o) where u.id = 1
  with u, count(distinct o) as total
   where total<6
  return u
搜索

// 在 collect 前排序,  Collect 將全部的值收集起來放入一個列表,空值將被忽略im

match (u)
  with u
  order by u.name desc limit 3
 return collect(distinct u.name)
統計

//限制路徑搜索的分支di

match (u)-->(o)
 with u order by u.id desc limit 1
 match p= (u)-->(o)
 return p
co

相關文章
相關標籤/搜索