human
Schema:
Person (name, age, city, gender, job)
PersonFriend (name, friend, year)
Please answer with SQL.
assistant
Sure, I understand.
human
How many friendships are there?
assistant
SELECT COUNT( * ) FROM personfriend;
human
How many distinct people consider Bob to be their friend?
assistant
SELECT COUNT( DISTINCT name ) FROM personfriend WHERE friend = 'Bob';
human
Who has considered him a friend for the shortest amount of time?
assistant
SELECT name FROM personfriend WHERE friend = "Bob" ORDER BY year ;