Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
11-13-2022 07:57 AM
Hi All.
I am learning "Intermediate Cypher Queries Course"
Testing List Inclusion | GraphAcademy (neo4j.com)
It Require me to:
Neo4j supports storing a single value or an array of values of the same type within a property.
In our data model, every :Movie
node has a languages
property which contains an array of strings. For example ['English', 'German', 'Italian']
.
Write and execute a query to return people who both acted in and directed a movie released in the German language.
How many unique Person node names are returned? (There will be duplicates that you should not count)
BUt when I check in sandbox with the query:
Solved! Go to Solution.
11-13-2022 07:01 PM - edited 11-13-2022 07:02 PM
“in” is used with lists to determine if a list contains an element.
"German" in m.languages is asking if the list contained in the property m.languages has an element equal to “German”
“contains” is used with string values to determine is a string contains another string as a subset or is equal.
m.languages CONTAINS "German" Is asking if the string stored in the property m.languages contains “German” as a substring or is equal to “German”
11-13-2022 09:19 AM
The 'contains' clause you are using is for determining if a string value contains another string. What you are looking for is the 'in' clause for lists.
match (m:Movie)
where "German" in m.languages
return m
11-13-2022 04:42 PM
Yeah, It OK Sir, But What is the deffirent in the clause Where
Where "German" in m.languages
and Where m.languages CONTAINS "German"
11-13-2022 07:01 PM - edited 11-13-2022 07:02 PM
“in” is used with lists to determine if a list contains an element.
"German" in m.languages is asking if the list contained in the property m.languages has an element equal to “German”
“contains” is used with string values to determine is a string contains another string as a subset or is equal.
m.languages CONTAINS "German" Is asking if the string stored in the property m.languages contains “German” as a substring or is equal to “German”
All the sessions of the conference are now available online