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

Who is the friend of Zach with longest year relationship?
SELECT friend FROM personfriend WHERE name = 'Zach' AND year = (SELECT MAX(year) FROM personfriend WHERE name = 'Zach')
SELECT "friend" FROM "personfriend" WHERE "name" = 'Zach' AND "year" = (SELECT MAX("year") FROM "personfriend" WHERE "name" = 'Zach')