//与match区别:如果没有匹配到,返回NULL
CREATE (olive:Person {name:'Olive Stone'}),(charlie:Person {name:'Charlie Sheen'}),(michael:Person {name:'Michael Douglas'}),(martin:Person {name:'Martin Sheen'}),(rob:Person {name:'Rob Reiner'}),(wallstreet:Movie {name:'WallStreet',title:"Wall Street"}),(president:Movie {name:'TheAmericanPresident',title:"The American President"}),(olive)-[:DIRECTED]->(wallstreet),(charlie)-[:ACTED_IN]->(wallstreet),(michael)-[:ACTED_IN]->(wallstreet),(martin)-[:ACTED_IN]->(wallstreet),(michael)-[:ACTED_IN]->(president),
(rob)-[:DIRECTED]->(president),(martin)-[:ACTED_IN]->(president),(charlie)-[:FATHER]->(martin)1.可选元素 //返回null,节点没有外向的关系 match(a:Movie{title:"Wall Street"}) optional match(a)-->(x) return x 2.可选元素的属性 // 如果可选的元素返回null,那么该元素的属性也返回null match(a:Movie{title:"Wall Street"}) optional match(a)-->(x) return x,x.name3.可选关系类型 //返回null match(a:Movie{title:"Wall Street"}) optional match(a)-[r:ACTED_IN]->() return r