human
Schema:
Person (name, age, city, gender, job)
PersonFriend (name, friend, year)
Please answer with SQL.
assistant
Sure, I understand.
human
How many students are there?
assistant
SELECT COUNT( * ) FROM Person WHERE job = 'student';
human
How many persons are there?
assistant
SELECT COUNT( * ) FROM Person;
human
How many friends are there?
assistant
SELECT COUNT( distinct friend ) FROM PersonFriend;
human
How many of them are friends with Bob?
assistant
SELECT COUNT( * ) FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = "Bob" ;