Tutorial by Examples

Create a node CREATE (neo:Company) //create node with label 'Company' CREATE (neo:Company {name: 'Neo4j', hq: 'San Mateo'}) //create node with properties Create a relationship CREATE (beginning_node)-[:edge_name{Attribute:1, Attribute:'two'}]->(ending_node) Query Templates Running neo...
CREATE (beginning_node)-[:edge_name{Attribute:1, Attribute:'two'}]->(ending_node)
Delete all nodes MATCH (n) DETACH DELETE n DETACH doesn't work in older versions(less then 2.3), for previous versions use MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n, r Delete all nodes of a specific label MATCH (n:Book) DELETE n
Match (node_name:node_type {}), (node_name_two:node_type_two {}) CREATE (node_name)-[::edge_name{}]->(node_name_two)
MATCH (n) WHERE n.some_attribute = "some identifier" SET n.other_attribute = "a new value"
Orphan nodes/vertices are those lacking all relationships/edges. MATCH (n) WHERE NOT (n)--() DELETE n

Page 1 of 1