MATCH (p:Person)-[:ACTED_IN]->(m:Movie {released: 2008})
RETURN p, m
MATCH (p:Person)-[:ACTED_IN]->(m:Movie)
WHERE m.released = 2008
RETURN p, m
MATCH (p:Person)-[:ACTED_IN]->(m:Movie)
WHERE m.released = 2008 OR m.released = 2009
RETURN p, m
MATCH (p:Person)-[:ACTED_IN]->(m:Movie)
WHERE (m.released = 2008) OR (m.released = 2009)
RETURN p, m
MATCH (p:Person)-[:ACTED_IN]->(m:Movie)
WHERE p.name='Jack Nicholson' AND exists(m.tagline)
RETURN m.title, m.tagline
MATCH (p:Person)-[:ACTED_IN]->()
WHERE p.name STARTS WITH 'Michael'
RETURN p.name
MATCH (p:Person)
WHERE p.name =~'Tom.*'
RETURN p.name
MATCH (p:Person)-[:WROTE]->(m:Movie)
WHERE NOT exists( (p)-[:DIRECTED]->(m) )
RETURN p.name, m.title
MATCH (p:Person)-[:WROTE]->(m:Movie)
WHERE NOT ( (p)-[:DIRECTED]->(m) )
RETURN p.name, m.title
MATCH (p:Person)
WHERE p.born IN [1965, 1970]
RETURN p.name as name, p.born as yearBorn
MATCH (p:Person)-[:WROTE]->(m:Movie)
RETURN p.name, m.title
MATCH (p)-[rel]->(m)
WHERE p:Person AND type(rel)='WROTE' AND m:Movie
RETURN p.name, m.title
MATCH (p1:Person)-[:ACTED_IN]->(m:Movie)<-[:ACTED_IN]-(p2:Person)
RETURN p1, p2
MATCH (meg:Person)-[:ACTED_IN]->(m:Movie)<-[:DIRECTED]-(d:Person),
(other:Person)-[:ACTED_IN]->(m)
WHERE meg.name = 'Meg Ryan'
RETURN m.title as movie, d.name AS director , other.name AS `co-actors`
MATCH (meg:Person)-[:ACTED_IN]->(m:Movie),
(d:Person)-[:DIRECTED]->(m:Movie),
(other:Person)-[:ACTED_IN]->(m)
WHERE meg.name = 'Meg Ryan'
RETURN m.title as movie, d.name AS director , other.name AS `co-actors`
MATCH (follower:Person)-[:FOLLOWS*2]->(p:Person)
RETURN follower, p
╒══════════════════════╤═══════════════════════════╕
│"follower" │"p" │
╞══════════════════════╪═══════════════════════════╡
│{"name":"Paul Blythe"}│{"name":"Jessica Thompson"}│
└──────────────────────┴───────────────────────────┘
MATCH (follower:Person)-[:FOLLOWS*2]->(p:Person)
RETURN follower, p
╒═════════════════════════╤═══════════════════════════╕
│"follower" │"p" │
╞═════════════════════════╪═══════════════════════════╡
│{"name":"Paul Blythe"} │{"name":"Angela Scope"} │
├─────────────────────────┼───────────────────────────┤
│{"name":"Angela Scope"} │{"name":"Jessica Thompson"}│
├─────────────────────────┼───────────────────────────┤
│{"name":"Paul Blythe"} │{"name":"Jessica Thompson"}│
├─────────────────────────┼───────────────────────────┤
│{"name":"James Thompson"}│{"name":"Jessica Thompson"}│
└─────────────────────────┴───────────────────────────┘
MATCH (follower:Person)-[:FOLLOWS]->(p:Person)
RETURN follower, p
╒═════════════════════════╤═══════════════════════════╕
│"follower" │"p" │
╞═════════════════════════╪═══════════════════════════╡
│{"name":"Paul Blythe"} │{"name":"Angela Scope"} │
├─────────────────────────┼───────────────────────────┤
│{"name":"James Thompson"}│{"name":"Jessica Thompson"}│
├─────────────────────────┼───────────────────────────┤
│{"name":"Angela Scope"} │{"name":"Jessica Thompson"}│
└─────────────────────────┴───────────────────────────┘
MATCH p = shortestPath((m1:Movie)-[*]-(m2:Movie))
WHERE m1.title = 'A Few Good Men' AND
m2.title = 'The Matrix'
RETURN m1, m2, p, Length(p)
MATCH (p:Person)-[r:REVIEWED]->(m:Movie)
WHERE p.name STARTS WITH 'James'
RETURN p.name, type(r), m.title
╒════════════════╤══════════╤═══════════════════╕
│"p.name" │"type(r)" │"m.title" │
╞════════════════╪══════════╪═══════════════════╡
│"James Thompson"│"REVIEWED"│"The Replacements" │
├────────────────┼──────────┼───────────────────┤
│"James Thompson"│"REVIEWED"│"The Da Vinci Code"│
└────────────────┴──────────┴───────────────────┘
MATCH (p:Person)
WHERE p.name STARTS WITH 'James'
OPTIONAL MATCH (p)-[r:REVIEWED]->(m:Movie)
RETURN p.name, type(r), m.title
╒═════════════════╤══════════╤═══════════════════╕
│"p.name" │"type(r)" │"m.title" │
╞═════════════════╪══════════╪═══════════════════╡
│"James Marshall" │null │null │
├─────────────────┼──────────┼───────────────────┤
│"James L. Brooks"│null │null │
├─────────────────┼──────────┼───────────────────┤
│"James Cromwell" │null │null │
├─────────────────┼──────────┼───────────────────┤
│"James Thompson" │"REVIEWED"│"The Replacements" │
├─────────────────┼──────────┼───────────────────┤
│"James Thompson" │"REVIEWED"│"The Da Vinci Code"│
└─────────────────┴──────────┴───────────────────┘
MATCH (p:Person)-[:ACTED_IN]->(m:Movie)
RETURN p.name, count(*)
MATCH (p1:Person)-[:ACTED_IN]->(m:Movie)<-[:DIRECTED]-(p2:Person)
RETURN p1.name, p2.name, count(*)
MATCH (p:Person)-[:ACTED_IN]->(m:Movie)
WHERE p.name ='Tom Cruise'
RETURN m.title
╒════════════════╕
│"m.title" │
╞════════════════╡
│"Jerry Maguire" │
├────────────────┤
│"Top Gun" │
├────────────────┤
│"A Few Good Men"│
└────────────────┘
MATCH (p:Person)-[:ACTED_IN]->(m:Movie)
WHERE p.name ='Tom Cruise'
RETURN collect(m.title)
╒════════════════════════════════════════════╕
│"collect(m.title)" │
╞════════════════════════════════════════════╡
│["Jerry Maguire","Top Gun","A Few Good Men"]│
└────────────────────────────────────────────┘
MATCH (a:Person)-[:ACTED_IN]->(m:Movie)
WITH a, count(a) AS numMovies
WHERE numMovies > 1
RETURN a.name, numMovies
ORDER BY numMovies DESC
╒════════════════════════╤═══════════╕
│"a.name" │"numMovies"│
╞════════════════════════╪═══════════╡
│"Tom Hanks" │12 │
├────────────────────────┼───────────┤
│"Keanu Reeves" │7 │
├────────────────────────┼───────────┤
│"Hugo Weaving" │5 │
├────────────────────────┼───────────┤
│"Jack Nicholson" │5 │
├────────────────────────┼───────────┤
│"Meg Ryan" │5 │
├────────────────────────┼───────────┤
│"Cuba Gooding Jr." │4 │
├────────────────────────┼───────────┤
MATCH (p:Person)-[:DIRECTED | :ACTED_IN]->(m:Movie)
WHERE p.name = 'Tom Hanks' AND 1993<m.released<1997
RETURN m.released, collect(m.title) AS movies
╒════════════╤═════════════════════════════════════════╕
│"m.released"│"movies" │
╞════════════╪═════════════════════════════════════════╡
│1996 │["That Thing You Do","That Thing You Do"]│
├────────────┼─────────────────────────────────────────┤
│1995 │["Apollo 13"] │
└────────────┴─────────────────────────────────────────┘
MATCH (p:Person)-[:DIRECTED | :ACTED_IN]->(m:Movie)
WHERE p.name = 'Tom Hanks' AND 1993<m.released<1997
RETURN m.released, collect(DISTINCT m.title) AS movies
MATCH (p:Person)-[:DIRECTED | :ACTED_IN]->(m:Movie)
WHERE p.name = 'Tom Hanks' AND 1993<m.released<1997
RETURN DISTINCT m.released, m.title AS movies
╒════════════╤═══════════════════╕
│"m.released"│"movies" │
╞════════════╪═══════════════════╡
│1996 │"That Thing You Do"│
├────────────┼───────────────────┤
│1995 │"Apollo 13" │
└────────────┴───────────────────┘
MATCH (a:Person)-[:ACTED_IN]->(m:Movie)
WITH m, count(m) AS numCast, collect(a.name) as cast
WHERE (numCast>3) AND ("Tom Hanks" in cast)
RETURN m.title, cast, numCast
ORDER BY size(cast) DESC
WITH [1, 2, 3] AS list
UNWIND list AS row
RETURN row, list
╒═════╤═══════╕
│"row"│"list" │
╞═════╪═══════╡
│1 │[1,2,3]│
├─────┼───────┤
│2 │[1,2,3]│
├─────┼───────┤
│3 │[1,2,3]│
└─────┴───────┘
RETURN date() AS now, date().year AS year
╒════════════╤══════╕
│"now" │"year"│
╞════════════╪══════╡
│"2019-12-28"│2019 │
└────────────┴──────┘
댓글남기기