https://neo4j.com/docs/cypher-manual/current/clauses/create/
1. single node
create (n)
2. multiple node
create (n), (m)
3. a node with a label
create (n:Person)
4. a node with multiple labels
create (n:Person:Swedish)
5. create node and add labels and properties
create (n:Person {name: 'Andy', title: 'Developer'})
6. return create node
create (a {name: 'Andy'})
return a.name
7. create a relationship between two nodes
MATCH
(a:Person),
(b:Person)
WHERE a.name = 'A' AND b.name = 'B'
CREATE (a)-[r:RELTYPE]->(b)
8. create a relationship and set properties
MATCH
(a:Person),
(b:Person)
WHERE a.name = 'A' AND b.name = 'B'
CREATE (a)-[r:RELTYPE {name: a.name + '<->' + b.name}]->(b)
RETURN type(r), r.name
9. create a full path
CREATE p = (andy:Person {name:'Andy'})-[:WORKS_AT]->(neo)<-[:WORKS_AT]-(michael:Person {name: 'Michael'})
RETURN p
'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] DELETE / 2023.02.03 (0) | 2023.02.03 |