liveBook · Manning

Create clause

As explained in Graph Algorithms for Data Science

The CREATE clause is a Cypher clause that inserts specified nodes and relationships into a graph database without checking for existing matching data.

CREATE stores a described graph pattern in Neo4j: nodes use parentheses, relationships use square brackets, and labels and properties can be specified inside the pattern. Cypher clauses are conventionally written in uppercase for readability. section 3.1.1 section 3.4

Create and return a node

CREATE (p:Person{name:'Frodo'}) RETURN p The CREATE clause stores a Person node with a name property. RETURN retrieves the variable for inspection or visualization in Neo4j Browser. Running the CREATE statement again creates another node because CREATE does not check for matching existing data. section 3.1.1

A single CREATE statement can store several nodes and their relationships. Relationships require adjacent nodes and are stored as directed; an undirected-looking pattern fails when used for creation. Empty unlabeled nodes are possible, but labeled nodes are recommended. section 3.4

Use CREATE when the input is trusted and new patterns should be inserted directly. For imports or repeated operations where duplicates are possible, use MATCH with MERGE instead; MERGE ensures that the specified pattern exists and supports idempotent imports. section 3.2.5 section 3.4

How Graph Algorithms for Data Science covers it

How deep it goes
Explains node, property, label, relationship, direction, RETURN, and duplicate behavior, but defers advanced query exceptions.
Examples
Demonstrates labeled people, properties, friendship relationships, Neo4j Browser visualization, and CSV-based social-network imports.
What it assumes
Assumes basic Cypher query familiarity while teaching graph-pattern notation, labels, properties, variables, and relationship direction.
What you can do after
Build it from scratch by writing Cypher patterns that insert nodes and directed relationships, then return created variables for inspection.
How it connects
Connects CREATE with nodes, relationships, labels, properties, RETURN, MATCH, MERGE, LOAD CSV, and Neo4j Browser.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Graph Algorithms for Data Science. The section links point to the parts of the book it draws on.