What is the average age of all people?
select avg(age) from person
What is the average age of the friends?
select avg(t1.age) from person as t1 join personfriend as t2 on t1.name = t2.friend
Show the average friend age for each person.
select t2.name, avg(t1.age) from person as t1 join personfriend as t2 on t1.name = t2.friend group by t2.name
Who has the highest?
select t2.name, avg(t1.age) from person as t1 join personfriend as t2 on t1.name = t2.friend group by t2.name order by avg(t1.age) desc limit 1