Neo4j String Matching and Case Expression
Exercise 1
Traverse all the employee nodes display Hi + employee name when
name is satish or
else display hello
match(e:employee) return
case e.name
when 'satish' then 'hi'+e.name
else 'hello'
end
Exercise 2
Traverse all employee nodes and display the salary
only for nodes satish or ram
for any other node display no salary
match(e:employee) return
case e.name
when 'satish' then e.salary
when 'ram' then e.salary
else 'hello No salary is set'
end
foreach clause
Traverse through all the employee nodes and set address property
match emp=(p:employee) foreach(employee in nodes(emp)|set employee.address='vellore')
Remove all the address property for employees
match emp=(p:employee) foreach(employee in nodes(emp)|remove employee.address)