(1)CREATE可以创建相同节点,merge若节点已存在,则不会重新添加。

CREATE (gp1:GoogleProfile1 {Id: 201401, Name:"Apple"})

CREATE (gp1:GoogleProfile1 {Id: 201401, Name:"Apple"})

MATCH (gp1:GoogleProfile1)  RETURN gp1.Id,gp1.Name

merge_节点-LMLPHP

MERGE (gp2:GoogleProfile2{ Id: 201402,Name:"Nokia"})

MERGE (gp2:GoogleProfile2{ Id: 201402,Name:"Nokia"})

merge_节点-LMLPHP

MATCH (gp2:GoogleProfile2) RETURN gp2.Id,gp2.Name

merge_节点-LMLPHP

(2)必须是节点的属性完全相同,否则,仍然创建新的节点。

MERGE (gp2:GoogleProfile2{ Id: 201402,Name:"Nokia",born:1989})

MATCH (gp2:GoogleProfile2) RETURN gp2.Id,gp2.Name,gp2.born
   merge_节点-LMLPHP

(3)节点不存在,则create set执行,match set不执行

merge(cc:Creditcard{name:"qiao"})on create set cc.time=3  on match set cc.year=2018 return cc.name,cc.time,cc.year

merge_节点-LMLPHP

(4)节点存在,match set执行,create set不执行

  create(into:Intopiece{name:"qiao"})return into

  merge(into:Intopiece{name:"qiao"})on create set into.time=3  on match set into.year=2018 return into.name,into.time,into.year

  merge_节点-LMLPHP

05-11 15:55