Creating and querying information
In the previous sections, we covered the types of objects a graph database can deal with and set up a working environment of the Neo4j desktop. As the next step, we will look at how to use the Cypher language that Neo4j supports to create and query objects in the database.
Creating a node
First, let's create our first node in the database by typing in the following Cypher command:
CREATE (c:Computer { hostname: "SATURN" } )
Afterward, hit the Play button to run the query. This will create our first node, as shown in the following screenshot:
Congratulations, you have created your first node!
The CREATE
keyword creates a new node. The parentheses define the structure of the node. The c
in the node definition, c:Computer
, is just an alias or variable for use in the query. We will leverage aliases a lot more later, so it's good to start using them constantly...