Who considers Alice to be their friend?
select name from personfriend where friend = 'Alice'
How about the other way around?
select friend from personfriend where name = 'Alice'
Find the names of those among them who are male.
select t2.friend from person as t1 join personfriend as t2 on t1.name = t2.friend where t2.name = 'Alice' and t1.gender = 'male'
And female?
select t2.friend from person as t1 join personfriend as t2 on t1.name = t2.friend where t2.name = 'Alice' and t1.gender = 'female'