How to join 2 tables in cypher, NEO4J
Request:
"List of movies in the category of games with a rental rate of more than $ 4
There are two tables: "Film" and "Film_category" have a common attribute "film_id"
How to solve this query, I read the documentation on how to join tables, didn't understand a word, please help me!
+3
source to share
1 answer
[Changed]
Assuming (from an earlier version of your question) that the following properties belong to all nodes with a label Film
:
- film_id
- name
- rental_rate
- replacement_cost
- rental_value
that all properties belong Film_category
:
- category_name
and that the model looks like this:
(:Film)-[:HAS_CATEGORY]->(:Film_category)
this query will answer your question:
MATCH (f:Film)-[:HAS_CATEGORY]->(c:Film_category)
WHERE f.rental_value > 4.0 AND c.category_name = 'Game'
RETURN f;
+3
source to share