create (n:User{id:1,name:'超级管理员'})
create (:User{id:2,name:"张三"})
create(u:User{id:3,name:"李四"}),(u2:User{id:4,name:"王五"}) //一次创建多个节点
create(u:User:Actor{id:5,name:"武松"}) //创建带有多个标签
// 在已有节点中创建关系
match (u1:User),(u2:User) where u1.id = 1 and u2.id = 2
create (u1)-[:DIRECT]->(u2)
//创建关系,并设置属性
match (u1:User),(u2:User) where u1.id = 2 and u2.id= 3
create (u1)-[r:DIRECT{type:'store'}]->(u2)
return r
//创建一个完整路径
create
(u1:User{id:6,name:'宋江'})
-[:DIRECT{type:'area'}]->
(u2:User{id:7,name:'李逵'})
<-[:DIRECT{type:'store'}]- (u3:User{id:8,name:'李鬼'})
创建了三个节点,和2个关系 或者:
create
p =
(u1:User{id:6,name:'宋江'})
-[:DIRECT{type:'area'}]->
(u2:User{id:7,name:'李逵'})
<-[:DIRECT{type:'store'}]- (u3:User{id:8,name:'李鬼'})
return p