Write Cypher queries for the following use cases (do not put any screenshots, on
ID: 3817464 • Letter: W
Question
Write Cypher queries for the following use cases (do not put any screenshots, only Cypher queries):
Retrieve all the employees (nodes).
List the first name, last name and salary of all employees.
Retrieve all employees (nodes) who work for the 'Sales' department.
Retrieve all employees (nodes), departments (nodes) and their ‘Sales’.
List all the department names which are located in Houston.
List all the first name and last name of employees, the project names that they have been working on, and the amount of time they spent for those projects.
Explanation / Answer
Cypher is a declarative language.
1.
MATCH (p:Person)<-[:EMPLOYEE]
RETURN p.fname p.lname p.salary
2.
MATCH (p:Person)<-[:EMPLOYEE]-(d:Department)
WHERE d.name = "Sales"
RETURN p
3.
MATCH (p:Person)<-[:EMPLOYEE]-(d:Department)
RETURN p, d, d.sales
4.
MATCH (d:Department)<-[:EMPLOYEE]
WHERE d.location= "Houston"
RETURN d.name
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.