general
- return
- as改变列名
- RETURN DISTINCT b(返回不重复)
- order by
- 默认升序(desc 逆序)
- 升序排序中null在最后,逆序null在最前
- limit
LIMIT toInt(3 * rand())+ 1
//也可以是表达式
- skip
- with
- unwind(展开)
UNWIND[1,2,3] AS x
RETURN x
WITH [1,1,2,2] AS coll UNWIND coll AS x
WITH DISTINCT x
RETURN collect(x) AS SET
- union
- union all 对结果进行并运算
- union对结果去重
- using
- 强制制定开始点
USING INDEX
- 强制制定开始点
reading
- match
--
查询所有相关节点(跳过关系),忽略类型和方向- 关系中存在空格等特殊字符,则用
` (backtick)
引用 - 变长路径用属性match
id(r)=0
//取id(节点或者是关系),比较的等号是单等号- 单条最短路径
所有最短路径(等长)
- 创建节点和关系
create (n1{num:1}),(n2{num:2}),...//这里n是变量名
create (n1)-[:rel]->(n2) //rel表示某种关系
- 删除节点和关系
delete n
//如果是删除节点,只删除节点,不删除关系,因此要保证关系已经被删除再删除节点 - 显示所有节点和关系
start n=node(*),r=relationship(*)
return n,r
查Match
索引
- 配置
先在neo4j.properties配置一下
- 在neo4j的console页面进行设置
(1)
index --create node_auto_index -t Node
(2)
index --indexes
(3) 最终效果:
时间: 2024-12-15 05:34:54