CREATE TABLE personfriend (name TEXT, friend TEXT, year DECIMAL)
CREATE TABLE person (name TEXT, age DECIMAL, city TEXT, gender TEXT, job TEXT)

Find Alice's friends of friends.
SELECT DISTINCT T4.name FROM personfriend AS T1 JOIN person AS T2 ON T1.name = T2.name JOIN personfriend AS T3 ON T1.friend = T3.name JOIN personfriend AS T4 ON T3.friend = T4.name WHERE T2.name = 'Alice' AND T4.name <> 'Alice'
SELECT DISTINCT "T4"."name" FROM "personfriend" AS "T1" JOIN "person" AS "T2" ON "T1"."name" = "T2"."name" AND "T2"."name" = 'Alice' JOIN "personfriend" AS "T3" ON "T1"."friend" = "T3"."name" JOIN "personfriend" AS "T4" ON "T3"."friend" = "T4"."name" AND "T4"."name" <> 'Alice'