I'm following one tutorial and I'm having a hard time understating the very basic things and I need your help. The code is:
CREATE (u:User {name: "Alice"})-[:Likes]->(m:Software {name: "Memgraph"});
The explanation for this code is: The query above will create 2 nodes in the database, one labeled "User" with name "Alice" and the other labeled "Software" with name "Memgraph". It will also create a relationship that "Alice" likes "Memgraph".
This part I get.
What I don't get is this: To find created nodes and relationships, execute the following query:
MATCH (u:User)-[r]->(x) RETURN u, r, x;
If I've created a node that has a variable (or how is u
called), why is the relation related to as r
, and software as x
? When a relation was created, it was just defined as :Likes
, and software was m
.
From where do r
and x
come from? Is there any connection between CREATE
and MATCH
or is the order the only an important thing and names are not important at all?