gpt4 book ai didi

neo4j - 在 Cypher 中使用 match({property}) 和 WHERE 子句的区别

转载 作者:行者123 更新时间:2023-12-01 11:15:14 25 4
gpt4 key购买 nike

我注意到 match(a:Vegetable{name:'Cellery'}) return amatch(a:Vegetable) where a.name='Cellery' return a给我同样的结果。

两者之间有什么实际区别吗?当您知道属性值时,第一种形式似乎工作得很好,但是有没有办法使用通配符或 LIKE 条件呢?

最佳答案

EXPLAIN and PROFILE options显示查询的执行计划。

它们为两个查询显示了完全相同的执行计划(在空数据库上)。

enter image description here

enter image description here

所以在性能方面,这两个符号应该完全相同。

The first form seems to work well when you know the property value, but is there a way to use wildcards or a LIKE condition with it?



没错, WHERE给你更多的灵活性。基本上, MATCH子句只允许您检查可以写为 WHERE a.prop1 = value1 AND a.prop2 = value2 AND ... 的相等性.同时, WHERE让你更多: AND/ OR/ XORNOT逻辑运算符,检查不等式;使用 STARTS WITH , CONTAINS , ENDS WITH和正则表达式;检查节点类型,如 WHERE (a:SomeLabel)甚至检查匹配的变量是否是像 WHERE NOT (a)-[:SOME_REL]->(:SomeLabel) 这样的模式的一部分.

关于neo4j - 在 Cypher 中使用 match({property}) 和 WHERE 子句的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46655570/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com