知识库

如何在 Cypher 中实现等效于 SQL HAVING 子句的功能

在传统的基于 SQL 的数据库中,HAVING 子句将限制聚合值。例如

select zipcode, count(*) as population
from Person
group by zipcode
having population>100000;

将返回所有居民超过 10 万的邮政编码。要在 Cypher 中实现相同的功能,请使用以下方法

match (n:Person)
with n.zipcode as zip, count(*) as population
where population > 100000
return zip, population