cancel
Showing results for 
Search instead for 
Did you mean: 

Correct answer not accepted in Snadbox

Valentina
Node

Hello,

I'm currently enrolled in the Graph Data Modelling Fundamental course and I am having an issue with certain queries

If I write 

MATCH (u:User)-[:RATED]-(m:Movie)
WHERE m.title="Apollo 13"
RETURN count(*) AS "Number of reviewers")

I get an error message

When I copy

MATCH (u:User)-[:RATED]-(m:Movie)
WHERE m.title = 'Apollo 13'
RETURN count(*) AS `Number of reviewers`

 

It works but they look the same to me

 

1 ACCEPTED SOLUTION

The logic of both queries is identical. You must have gotten an error with the first because you need to enclose the "Number of Reviews" in back ticks for it to work. That is the syntax when using a string with spaces in it to represent a variable, property, or an output label. 

View solution in original post

6 REPLIES 6

This should work:

MATCH (u:User)-[:RATED]-(m:Movie)
WHERE m.title="Apollo 13"
RETURN count(*) AS Number of reviewers

glilienfield
Ninja
Ninja

You need to use back ticks when enclosing a string to be used as an output label.  Also, you have an extra right parenthesis at the end. 

Ah yes! I forgot to add the back tics!  Thanks @glilienfield 

Valentina
Node

Thank you both for your help. I wasn't sure if it was related to that as "Apollo 13" was accepted (the parenthesis is a spelling mistake here not in the query) and I don't know if there's a difference between the two in terms of what they are (like I never heard "output label". Guess I just have to proceed with the course to find out more

The logic of both queries is identical. You must have gotten an error with the first because you need to enclose the "Number of Reviews" in back ticks for it to work. That is the syntax when using a string with spaces in it to represent a variable, property, or an output label. 

Thanks a lot!

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.