Show name and age of the people who are friends with Dan.
select t1.name, t1.age from person as t1 join personfriend as t2 on t1.name = t2.name where t2.friend = 'Dan'
How about the friends of Alice?
select t1.name, t1.age from person as t1 join personfriend as t2 on t1.name = t2.name where t2.friend = 'Alice'
Show the union of the sets.
select t1.name, t1.age from person as t1 join personfriend as t2 on t1.name = t2.name where t2.friend = 'Dan' union select t1.name, t1.age from person as t1 join personfriend as t2 on t1.name = t2.name where t2.friend = 'Alice'
How about the intersections?
select t1.name, t1.age from person as t1 join personfriend as t2 on t1.name = t2.name where t2.friend = 'Dan' intersect select t1.name, t1.age from person as t1 join personfriend as t2 on t1.name = t2.name where t2.friend = 'Alice'