CREATE clause is used to introduce new nodes and relationships into the graph.
Creating Nodes
The simplest example creates a single node without any labels or properties:Creating Relationships
To add relationships between nodes, you typically match existing nodes first, then create the relationship. In this example, we find an existing source node and create a new relationship with a new destination node:(a:Person) is matched (bound), while the destination node (:Band) is unbound and will be created.
This query creates a new node representing the band Nirvana and a new MEMBER relationship connecting Kurt to the band.
Creating Complete Patterns
You can create entire graph patterns in a single statement. All entities within the pattern that are not bound (matched) will be created:Frequently Asked Questions
Can I create nodes and relationships in a single query?
Can I create nodes and relationships in a single query?
Yes. You can create entire graph patterns in one CREATE statement. All unbound entities in the pattern will be created as new nodes and relationships.
How do I create a relationship between existing nodes?
How do I create a relationship between existing nodes?
Use MATCH to find the existing nodes first, then CREATE the relationship:
MATCH (a:Person {name: 'Alice'}), (b:Person {name: 'Bob'}) CREATE (a)-[:KNOWS]->(b).What happens if I CREATE a node without a label?
What happens if I CREATE a node without a label?
FalkorDB allows creating nodes without labels using
CREATE (n). The node will exist in the graph but cannot be efficiently queried by label-based index scans.Can I set properties during CREATE?
Can I set properties during CREATE?
Yes. Include properties in curly braces:
CREATE (:Person {name: 'Alice', age: 30}). Multiple properties are separated by commas.