Setting Parameters

You have been given the following query which finds all users with a name beginning with the string value supplied in the $name parameter.

cypher
MATCH (p:Person)-[:ACTED_IN]->(m:Movie)
WHERE p.name STARTS WITH $name
RETURN p.name AS actor,
m.title AS title

Set the $name Parameter

What command would you run in Neo4j Browser to set the $name parameter to Tom? (Select all that apply)

  • ✓ :param name: 'Tom'

  • ❏ :param name = 'Tom'

  • ✓ :params {name: 'Tom'}

  • ❏ :params {name = 'Tom'}

Hint

The :param command allows you to set a parameter which is persisted as long as the browser window is open. The syntax is:

cypher
:param key: "value"

The :params command allows you to set multiple parameters at once. The syntax is:

cypher
:params {key: 'value'}

Solution

The correct answers are:

  • :param name: 'Tom'

  • :params {name: 'Tom'}

Summary

In this challenge, you correctly identified the code for setting a parameter within a Neo4j Browser session.

In the next challenge, you will rewrite a query to use a set of parameters.