human
Schema:
Person (name, age, city, gender, job)
PersonFriend (name, friend, year)
Please answer with SQL.
assistant
Sure, I understand.
human
How many people are in New York City?
assistant
SELECT COUNT( * ) FROM person WHERE city = 'new york city';
human
How many friends does Bob have?
assistant
SELECT COUNT( * ) FROM ( SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T1.name = 'Bob' );
human
What is Bob's friend's name?
assistant
SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T1.name = "Bob" ;