基本操作:
1. 启动Neo4j服务:
neo4j start
2. 停止Neo4j服务:
neo4j stop
3. Neo4j Browser地址:
neo4j start
neo4j stop
CREATE (n:Person {name: 'John', age: 30})
RETURN n;
MATCH (a:Person {name: 'John'}), (b:Person {name: 'Alice'})
CREATE (a)-[:KNOWS]->(b);
MATCH (n:Person)
RETURN n;
MATCH (:Person)-[r:KNOWS]->(:Person)
RETURN r;
MATCH (n:Person {name: 'John'})
SET n.age = 31
RETURN n;
MATCH (n:Person {name: 'John'})
DETACH DELETE n;
MATCH (p:Person)
WHERE p.age > 25
RETURN p;
MATCH (p:Person)
RETURN p
ORDER BY p.age DESC
LIMIT 5;
MATCH (a:Person)-[:KNOWS]->(b)
WITH a, count(b) AS friendCount
WHERE friendCount > 5
RETURN a;
CREATE INDEX ON :Person(name);
CREATE CONSTRAINT ON (p:Person) ASSERT p.email IS UNIQUE;
BEGIN
COMMIT
ROLLBACK
LOAD CSV WITH HEADERS FROM 'file:///data.csv' AS row
CREATE (:Person {name: row.name, age: toInt(row.age)});
FOREACH (name IN ['John', 'Alice', 'Bob'] |
CREATE (:Person {name: name}));
MATCH (p:Person {name: 'John'}) RETURN p
UNION
MATCH (p:Person {name: 'Alice'}) RETURN p;