DDL Queries
index
creating index
CREATEINDEX index_name FOR (n:Person) ON (n.surname)list indices:
SHOW INDEXESdeleting index
DROPINDEX index_name
unique constraint
create unique constraint on node.id
CREATE(Dhawan:player{id:001, name: “shikar Dhawan”, YOB: 1995, POB: “Delhi”})CREATE(Jonathan:player {id:002, name: “Jonathan Trott”, YOB: 1981, POB: “CapeTown”})CREATE(Sangakkara:player {id:003, name: “Kumar Sangakkara”, YOB: 1977, POB: “Matale”})CREATE(Rohit:player {id:004, name: “Rohit Sharma”, YOB: 1987, POB: “Nagpur”})CREATE(Virat:player {id:005, name: “Virat Kohli”, YOB: 1988, POB: “Delhi”})// create unique constraintCREATE CONSTRAINT ON (n:player) ASSERT n.id IS UNIQUE// verify constraintCREATE(Virat:player {id:005, name: “Virat Kohli”, YOB: 1988, POB: “Delhi”})drop unique constraint:
DROP CONSTRAINT constraint_name