Neo4j的sql语句
CREATE (:student {name:'小张',age:20}),(:student {name:'彭莎丽',age:18})
这样删除是将student中的条件节点删除——>会变成空白节点
match (m:student {name:"Fairy同学"}) remove m:student
MATCH (student) where id(student)=60 delete student
MATCH (n {name:"Fairy同学"}) delete n
MATCH (n) WHERE id(n) = 2066 DETACH DELETE n
RETURN n
MATCH (n:student {name:"邬雨航"}) set n.address='长沙' return n
match (n:student {name:'邬雨航'}),(m:student{name:'Fairy同学'})
create (n)-[r:`别名`{relation:'别名'}]->(m) return r
MATCH (n:student {name:'邬雨航'}),(m:student {name:'彭莎丽'})
create (n)-[r:`密友`{relation:'密友'}]->(m) return r
学校和学生之间的关系:
match (n:student {name:'邬雨航'}),(m:school{name:'长沙理工大学城南学院'})
create (n)-[r:`所在学校`{relation:'学校'}]->(m) return r
Match (p:student) -[*]->(s:student) where id(p)=64 return s
create p=(:student{name:'邬雨航'})-[:职业]->(:offer{name:'开发工程师'})<-[:职业]-
(:student {name:'小张'}) return p
MATCH (p1:student {name:'邬雨航'})-[r:`所在学校`]-(p2:student {name:'彭莎丽'})
DELETE r
1.第一种,单向:
MATCH (n:student {name:'邬雨航'})-->(b) return n,b
2.第二种,双向:
MATCH (n:student {name:'校长'})<-->(b) return n,b
//1.指定条件
MATCH (r) WHERE id(r) = 60 DETACH DELETE r
//2.全删除
MATCH (r) DETACH DELETE r
添加name的唯一约束
CREATE CONSTRAINT ON (cc:student)
ASSERT cc.name IS UNIQUE
match (n:student) return count(n)
MATCH (s:student) RETURN MAX(s.age),SUM(s.age)
```![在这里插入图片描述](https://img-blog.csdnimg.cn/6c4e0d75fb5e44dba274f2231c6b5659.png)