CREATE (neo:Company) //create node with label 'Company'
CREATE (neo:Company {name: 'Neo4j', hq: 'San Mateo'}) //create node with properties
CREATE (beginning_node)-[:edge_name{Attribute:1, Attribute:'two'}]->(ending_node)
Running neo4j locally, in the browser GUI (default: http://localhost:7474/browser/), you can run the following command to get a palette of queries.
:play query template
This helps you get started creating and merging nodes and relationships by typing queries.
CREATE (beginning_node)-[:edge_name{Attribute:1, Attribute:'two'}]->(ending_node)
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
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