neo4j cypher基本操作
时间: 2023-10-05 09:09:47 浏览: 170
Cypher是Neo4j数据库的查询语言,用于对图数据库进行操作和查询。以下是一些Neo4j Cypher的基本操作:
1. 创建节点:
CREATE (node:Label {property1: value1, property2: value2, ...})
2. 创建关系:
MATCH (node1:Label1), (node2:Label2)
WHERE node1.property = value1 AND node2.property = value2
CREATE (node1)-[:RELATIONSHIP_TYPE]->(node2)
3. 查询节点和关系:
MATCH (node:Label {property: value})-[relationship:RELATIONSHIP_TYPE]->(relatedNode)
RETURN node, relationship, relatedNode
4. 更新节点属性:
MATCH (node:Label {property: value})
SET node.property = newValue
5. 删除节点和关系:
MATCH (node:Label {property: value})-[relationship:RELATIONSHIP_TYPE]->(relatedNode)
DELETE node, relationship, relatedNode
6. 查询结果限制和排序:
MATCH (node:Label)
RETURN node.property
ORDER BY node.property
LIMIT n
以上是一些基本的Cypher操作,你可以根据你的具体需求和场景进一步学习和探索更多Cypher语言的功能和用法。
阅读全文