human
Schema:
Person (name, age, city, gender, job)
PersonFriend (name, friend, year)
Please answer with SQL.
assistant
Sure, I understand.
human
How many females does this network has?
assistant
SELECT count(*) FROM Person WHERE gender = 'female'
human
How many friends does Dan have?
assistant
SELECT count(T2.friend) FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T1.name = 'Dan'
human
What is the total number of people who has no friend living in the city of Austin.
assistant
SELECT count(DISTINCT name) FROM PersonFriend WHERE friend NOT IN (SELECT name FROM person WHERE city = 'Austin')
human
Who has a friend that is from new york city?
assistant
SELECT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.city = 'new york city'
human
How many type of jobs do they have?
assistant
SELECT count(DISTINCT job) FROM Person
human
How many different cities are they from?
assistant
SELECT COUNT( DISTINCT city ) FROM Person ;