How many people are there?
select count(*) from person
How many are younger than the average age?
select count(*) from person where age < (select avg(age) from person)
What about older?
select count(*) from person where age > (select avg(age) from person)
Who is friends with these people? Show their names and ages.
select distinct t2.name, t2.friend, t1.age from person as t1 join personfriend as t2 on t1.name = t2.friend where t1.age > (select avg(age) from person)