0
votes


I am a newbie to Neo4j, I have created two nodes with the below Cypher , how can I create a relationship between them ?

CREATE (Someone { name:'Abhilash',from :'Kerala',knows:'java' }) return someone;

CREATE (Someone { name:'Theo',worked :'WALMART',from:'kUNOOR' });return someone;

The relationship is 'Team: QualityControl'.

Second Question

Also I have seen in some create node queries that are using back tick (`) symbols in code. e.g.

CREATE (_1:`Someone` { `name`:"Abhilash",`from`:"Kerala":,`knows`:"java" })

Whats the difference between the first create statement and the above create statement ? Can we create properties of nodes as

{key:'Values'} or {<back tick> key <back tick>:"Values"} 

where < back tick > is `

Am much confused with the different ways of using tick(`) , double Quote ("") ans single quote (') inside the query . Can any one help me to understand the right scenarios of using these characters ?

Update thanks for the clarification . i used the below query to create the relationship , but its not returning any result or creating a relationship between my nodes . this is my statement,

MATCH (a:someone),(b:someone) 
WHERE a.name = 'Abhilash' AND b.name = 'Theo' 
CREATE a-[r:RELTYPE]->b 
RETURN r
1
You would probably also model the from and knows information as relationships to appropriate location and skill nodes.Michael Hunger

1 Answers

1
votes

Backtick is only used if you have a character in a property name or reltype that isn't valid to cypher, such as spaces or hyphens. I recommend avoiding the need to use backticks.

Double quotes and single quotes are interchangeable to represent strings, similar to JavaScript. I usually go the route of using double quotes and escaping internal double quotes with backslash: {dialog:"Joe said, \"Hello World.\""}...

As an aside, you probably don't want to use "Team: Quality Control" as a relationship. That should probably be a node with relationships to each team member.