Question 1
Suppose you have a graph that contains nodes representing customers and other business entities for your application. The node label in the database for a customer is Customer. Each Customer node has a property named email that contains the customer’s email address. What Cypher query do you execute to return the email addresses for all customers in the graph?
Select the correct answer.
- MATCH (n) RETURN n.Customer.email
- MATCH (c:Customer) RETURN c.email
- MATCH (Customer) RETURN email
- MATCH (c) RETURN Customer.email
Suppose you have a graph that contains Customer and Product nodes. A Customer node can have a BOUGHT relationship with a Product node. Customer nodes can have other relationships with Product nodes. A Customer node has a property named customerName. A Product node has a property named productName. What Cypher query do you execute to return all of the products (by name) bought by customer 'ABCCO'.
Select the correct answer.
- MATCH (c:Customer {customerName: 'ABCCO'}) RETURN c.BOUGHT.productName
- MATCH (p:Product)←[:BOUGHT]-(:Customer 'ABCCO') RETURN p.productName
- MATCH (p:Product)←[:BOUGHT_BY]-(:Customer 'ABCCO') RETURN p.productName
- MATCH (p:Product)←[:BOUGHT]-(:Customer {customerName: 'ABCCO'}) RETURN p.productName
Thus far, you have learned to use a simple MATCH clause to return values. When must you use a variable in a simple MATCH clause?
Select the correct answer.
- When you want to query the graph using a node label.
- When you specify a property value to match the query.
- When you want to use the node or relationship to return a value.
- When the query involves 2 types of nodes.