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 there?
assistant
SELECT COUNT( * ) FROM person;
human
How many are younger than the average age?
assistant
SELECT COUNT( * ) FROM person WHERE age < ( SELECT AVG ( age ) FROM person );
human
What about older?
assistant
SELECT COUNT( * ) FROM person WHERE age > ( SELECT AVG ( age ) FROM person ) ;