1、新增node
create (n:Person{name:“xiaomi”}), (m:Person{name:“huawei”}), (q:Person{name:“apple”})
2、删除/删除所有节点关系
match (n) optional match (n)-[r]-() delete n,r
3、构建关系
create ()-[]->()
match(from:Stock{cocode:line.stock_code}),(to:Exchange{id:{line.exchange_id}} merge (from)-[r:交易所]->(to)
4、DELETE删除
删除节点:match(n:person{name:‘白龙马’})delete n
删除关系:match(n:person{name:‘白龙马’})<-[r]-(m) delete r return type®
5、REMOVE删除 --这个删除的是属性或者标签
删除属性:
match(n:role{name:“fox”})remove n.age return n
创建节点:
create (n:role:person{name:“xiaomi”})
删除标签:
match (n:role:person{name:“xiaomi”}) remove n:persion return n
注意:merge = create+match;
6、RETURN返回一般都是配合match
match (n:‘xiaomi’) RETURN id(n), n.name, n.tail, n.relation
7、WHERE子句 和SQL where类似
match(n:person)where n.name=‘孙悟空’ or n.name =‘猪八戒’ RETURN n
match(n:person)(m:person)where n.name=‘孙悟空’ or m.name =‘猪八戒’
create (n)-[r:师弟]->(m) return n.name, type®, m.name
8、SET子句
match (n:role {name:“xiaomi”}) set n.price=1999.99 return n
9、ORDER BY 排序
match (n:person) return id(n), n.name order by id(n) desc
10、SKIP 略过几条
match (n:person) return id(n), n.name skip 5