19.COUNT() , AVG() 聚合函数
在下边的例子我们使用COUNT()函数来告诉我们有多少文档在桶里。
COUNT() Query:
SELECT COUNT(*) AS count
FROM tutorial
结果:
{
"results": [
{
"count": 6
}
]
}
AVG() Query:
SELECT COUNT(*) AS count, AVG(c.age) AS avg_age
FROM tutorial t
UNNEST t.children c
WHERE c.age > 10
结果:
{
"results": [
{
"avg_age": 18,
"count": 4
}
]
}
Last updated
Was this helpful?