()
(p:Person {name: '홍길동'})
(사람:user)
(:Food)
(:음식)
(t:Technology)
(동해:장소)
CREATE (friend:Person {name: '홍길동'})
RETURN friend
CREATE (p:Person)-[:LIKES {since: 2019}]->(t:Technology)
MATCH (jennifer:Person {name: 'Jennifer'})
MATCH (mark:Person {name: 'Mark'})
CREATE (jennifer)-[rel:IS_FRIENDS_WITH]->(mark)
MATCH (p:Person)
RETURN p
LIMIT 10
MATCH (:Person {name: 'Tom Hanks'})-[:DIRECTED]->(movie:Movie)
RETURN movie
MATCH (:Person {name: 'Tom Hanks'})-[:DIRECTED]->(movie:Movie)
RETURN movie.title
MATCH (tom:Person {name:'Tom Hanks'})-[rel:DIRECTED]-(movie:Movie)
RETURN tom.name, tom.born, movie.title, movie.released
MATCH (p:Person {name: 'Jennifer'})
SET p.birthdate = date('1980-01-01')
RETURN p
return 값이 없어도 된다.
MATCH (j:Person {name: 'Jennifer'})-[r:IS_FRIENDS_WITH]->(m:Person {name: 'Mark'})
DELETE r
MATCH (m:Person {name: 'Mark'})
DELETE m
직접 예시를 실행해보면서 결과를 확인해보았다.
create (d:Developer {name:'amud', age:25, country:'Korea'}) return d;
create (d:Developer {name:'cindy', age:15, country:'USA'}) return d;
create (d:Developer {name:'hana', age:20, country:'Canada'}) return d;
create (d:Developer {name:'jessica', age:22, country:'Germany'}) return d;
create (d:Designer {name:'taylor', age:30, country:'USA'}) return d;
create (d:Designer {name:'nana', age:32, country:'Korea'}) return d;
create (f:Fruit {name:'apple',color:'red'}) return f;
create (f:Fruit {name:'banana',color:'yellow'}) return f;
create (f:Fruit {name:'orange',color:'orange'}) return f;
노드를 모두 생성한 결과는 아래와 같다. 오른쪽에 라벨 정보도 확인할 수 있다.
MATCH (a:Developer) WHERE a.name = "jessica"
MATCH (b:Fruit) WHERE b.name="apple"
CREATE (a) -[r:LIKE]->(b) RETURN r;
MATCH (a:Developer) WHERE a.name = "jessica"
MATCH (b:Fruit) WHERE b.name="banana"
CREATE (a) -[r:LIKE]->(b) RETURN r;
MATCH (a:Developer) WHERE a.name = "amud"
MATCH (b:Fruit) WHERE b.name="banana"
CREATE (a) -[r:LIKE]->(b) RETURN r;
MATCH (a:Developer) WHERE a.name = "cindy"
MATCH (b:Fruit) WHERE b.name="orange"
CREATE (a) -[r:LIKE]->(b) RETURN r;
MATCH (a:Designer) WHERE a.name = "nana"
MATCH (b:Fruit) WHERE b.name="apple"
CREATE (a) -[r:LIKE]->(b) RETURN r;
MATCH (a:Designer) WHERE a.name = "taylor"
MATCH (b:Fruit) WHERE b.name="apple"
CREATE (a) -[r:HATE]->(b) RETURN r;
MATCH (a:Developer) WHERE a.name = "hana"
MATCH (b:Developer) WHERE b.name="cindy"
CREATE (a) -[r:IS_FRIEND]->(b) RETURN r;
MATCH () -[r:IS_FRIEND]->()
DELETE r
MATCH (n) RETURN n;
The property existence syntax ‘… exists(variable.property)’ is no longer supported.
개체 및 관계 쿼리에서 발생하는 위 오류는 버전 4에서는 exists를 지원하지 않아 발생한다. 설명을 그대로 IS NOT NULL로 바꿔서 활용하면 된다.