MATCH (n)
RETURN n
노드에 부여된 변수명
:노드명
) RETURN 노드에 부여된 변수명
MATCH (player:PLAYER)
RETURN player
노드에 부여된 변수명
:노드명
) RETURN 노드에 부여된 변수명
.노드의 name 속성
MATCH (player:PLAYER)
RETURN player.name
MATCH (player:PLAYER)
RETURN player.name, player.height
MATCH (player:PLAYER)
RETURN player.name AS name, player.height AS height
MATCH (player:PLAYER)
WHERE player.name = "LeBron James"
RETURN player
MATCH (player:PLAYER {name: "LeBron James"})
RETURN player
MATCH (player:PLAYER)
WHERE player.name = "LeBron James", player.height = 2.06
RETURN player
MATCH (player:PLAYER {name: "LeBron James", height: 2.06})
RETURN player
MATCH (player:PLAYER)
WHERE player.height >= 2
RETURN player
MATCH (player:PLAYER)
WHERE (player.weight / (player.height * player.height)) > 25
RETURN player
MATCH (player:PLAYER)
WHERE player.weight >= 100 AND player.height <= 2
RETURN player
MATCH (player:PLAYER)
WHERE player.weight >= 120 OR player.height >= 2.1
RETURN player
MATCH (player:PLAYER)
WHERE NOT player.weight >= 120 OR player.height >= 2.1
RETURN player
MATCH (player:PLAYER)
WHERE player.height >= 2
RETURN player
LIMIT 2
MATCH (player:PLAYER)
WHERE player.height >= 2
RETURN player
SKIP 2
LIMIT 2
ASC
: 오름차순, DESC
: 내림차순MATCH (player:PLAYER)
WHERE player.height >= 2
RETURN player
ORDER BY player.height ASC
MATCH (player:PLAYER)
WHERE player.height >= 2
RETURN player
ORDER BY player.height DESC
MATCH
한 노드를 출력하고 RETURN
한 노드와의 관계까지 출력MATCH (player:PLAYER), (coach:COACH)
RETURN player
MATCH (player:PLAYER), (coach:COACH), (team:TEAM)
WHERE player.height >= 2
RETURN player, coach, team
MATCH (player:PLAYER) -[:PLAYS_FOR]-> (team:TEAM)
MATCH (team:TEAM) <-[:PLAYS_FOR]- (player:PLAYER)
MATCH (player:PLAYER) -[contract:PLAYS_FOR]-> (team:TEAM)
WHERE contract.salary >= 35000000
RETURN player
MATCH (lebron:PLAYER {name: "LeBron James"}) -[:TEAMMATES]-> (teammate:PLAYER)
RETURN teammate
응용
MATCH (lebron:PLAYER {name: "LeBron James"}) -[:TEAMMATES]-> (teammate:PLAYER)
MATCH (teammate) -[contract:PLAYS_FOR]-> (team:TEAM)
WHERE contract.salary >= 4000000
RETURN teammate
MATCH (player:PLAYER) -[gamePlayed:PLAYED_AGAINST]-> (:TEAM)
RETURN player.name, COUNT(gamePlayed)
응용
MATCH (player:PLAYER) -[gamePlayed:PLAYED_AGAINST]-> (:TEAM)
RETURN player.name, AVG(gamePlayed) AS ppg ORDER BY ppg DESC
LIMIT 1
MATCH (joel {name: "Joel Embiid"}) -[rel:PLAYS_FOR]-> (:TEAM)
DELETE rel
MATCH (n)
DETACH DELETE n