Wednesday 4 August 2021

Neo4j: Exercise 2: Nodes with multiple labels

Create three nodes Rama, Murali and Nayana.

Label Rama with Person, Cricketer, Singer

Label Murali with Person, Engineer, Blogger.

Label Nayana with Person, Engineer and Singer

 

Step 1: Open neo4j browser by hitting following url in browser.

http://localhost:7474/browser/

 

 


Step 2: Create nodes by executing below queries.

CREATE (r:Person:Cricketer:Singer{name: "Rama", age: 32, city: "Bangalore", male: true}),

(m:Person:Engineer:Blogger{name: "Murali", age: 34, city: "Hyderabad", male: true}),

(n:Person:Engineer:Singer{name: "Nayana", age: 34, city: "Hyderabad", female: true}) RETURN r, m, n

 

 


Query all nodes which are labelled with Singer

MATCH (node:Singer) RETURN node

 


Query all the nodes which are labelled with both Singer and Engineer

MATCH (node:Singer:Engineer) RETURN node

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment