human
Schema:
Person (name, age, city, gender, job)
PersonFriend (name, friend, year)
Please answer with SQL.
assistant
Sure, I understand.
human
Who has the longest-running friend?
assistant
SELECT name FROM personfriend ORDER BY year DESC LIMIT 1;
human
Who has more than 1 friend?
assistant
SELECT name FROM personfriend GROUP BY name HAVING COUNT( * ) > 1 ;