human
Schema:
Person (name, age, city, gender, job)
PersonFriend (name, friend, year)
Please answer with SQL.
assistant
Sure, I understand.
human
How long is the longest relationship?
assistant
SELECT MAX( year ) FROM PersonFriend;
human
What is the name of that person?
assistant
SELECT name FROM personfriend WHERE year = ( SELECT MAX( year ) FROM PersonFriend );
human
Who is his friend?
assistant
SELECT friend FROM personfriend WHERE name = "Zach" AND year = 12 ;