Hi, I'm trying to think of a shorter and understandable code for my question.
I would love ideas and suggestions. This is my question and code.
MATCH (p:Person)-[:Has_FB_Frienship_With]-(n:Person)
WHERE date().year-p.BirthYear<=12 AND date().year-n.BirthYear>=20 AND p.Gender<>n.Gender
RETURN p.PersonID AS younger_id, p.First_name AS younger_F_name,p.Last_name AS younger_L_name, p.Gender AS Younger_Gender,date().year-p.BirthYear AS younger_Age, n.PersonID AS older_id, n.First_name AS older_F_name,n.Last_name AS older_L_name, n.Gender AS Older_Gender, date().year-n.BirthYear AS older_Age
For reasons of caution and child protection, a particular supervisory body wants to locate friendships between two people that meet
The following criteria:
a) They are of a different gender.
b) one of them is less than 12 and the other is greater than 20.
Note: To calculate the age one must of course use the parameter of the current year. Do not write it
As usual, but use the Cypher variable (so that the query will run properly in the coming years as well)