O'Reilly logo

Learning Cypher by Onofrio Panzarino

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating nodes and relationships

In this section, we will learn how to create nodes and relationships in our database. Let's start with the simplest example, that is, creating our first node. In the prompt, just type the following:

CREATE ()

This command creates a node without properties or labels. It's equivalent to the following Java code:

Node n = graphDb.createNode();

The result panel now shows the result as Created 1 node, returned 0 rows in 825 ms.

The preceding command returned zero rows because we had no RETURN clause. It just created an anonymous node in the database. This node is not very useful as it is, as it can be referenced only by an ID. However, the command lets us introduce the CREATE clause. The CREATE clause takes one argument: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required