Graph Database
CREATE (person {name : 'John'})
RETURN person;
START a=node(9), b=node(10)
CREATE a-[rel:friend]->b
RETURN rel
START n=node(*)
RETURN n
START n=node:nodes(name = "John")
RETURN n
SELECT Person.name as PERSON, PersonFriend.friend_id as FRIEND
FROM Person
INNER JOIN PersonFriend
ON Person.id = PersonFriend.person_id
WHERE Person.name = 'John';
Cyper
START person=node:Person(name = 'John')
MATCH person-[:friend]->friend
RETURN friend
SELECT Person.name as PERSON, pf1.friend_id as COMMON, pf2.friend_id as FoF
FROM Person
INNER JOIN PersonFriend pf1 ON Person.id = pf1.person_id
INNER JOIN PersonFriend pf2 ON pf1.friend_id = pf2.person_id
WHERE Person.name = 'John';
START person=node:Person(name = 'John')
MATCH person-[:friend]->common_friend-[:friend]->friend
RETURN friend, common_friend
Adapted from: