https://neo4j.com/docs/cypher-manual/current/clauses/delete/
* Example Graph
CREATE
(keanu:Person {name: 'Keanu Reever'}),
(laurence:Person {name: 'Laurence Fishburne'}),
(carrie:Person {name: 'Carrie-Anne Moss'}),
(tom:Person {name: 'Tom Hanks'}),
(theMatrix:Movie {title: 'The Matrix'}),
(keanu)-[:ACTED_IN]->(theMatrix),
(laurence)-[:ACTED_IN]->(theMatrix),
(carrie)-[:ACTED_IN]->(theMatrix)
1. Delete single node (관계가 없는 노드만 가능)
match (n:Person {name: 'Tom Hanks'}) delete n
2. Delete relationships only
match(n:Person {name:'Laurence Fishburne'})-[r:ACTIVE_IN]->()
delete r
3. Delete a node with all its relationships
MATCH (n:Person {name: 'Carrie-Anne Moss'})
DETACH DELETE n
4. Delete all nodes and relationships
match(n) detach delete n
'DKE > Neo4j' 카테고리의 다른 글
[Neo4j] MATCH (Relationship basics) / 2023.02.06 (0) | 2023.02.06 |
---|---|
[Neo4j] MATCH (Basic node finding) / 2023.02.06 (0) | 2023.02.06 |
[Neo4j] REMOVE / 2023.02.03 (0) | 2023.02.03 |
[Neo4j] SET / 2023.02.03 (0) | 2023.02.03 |
[Neo4j] CREATE / 2023.02.02 (0) | 2023.02.02 |