Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
09-28-2022 08:17 AM
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
Solved! Go to Solution.
09-29-2022 12:18 PM
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.
09-28-2022 08:40 AM
This should work:
MATCH (u:User)-[:RATED]-(m:Movie)
WHERE m.title="Apollo 13"
RETURN count(*) AS Number of reviewers
09-28-2022 11:16 AM
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.
09-29-2022 07:26 AM
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
09-29-2022 12:18 PM
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.
09-30-2022 01:06 AM
Thanks a lot!
All the sessions of the conference are now available online