human
Schema:
Person (name, age, city, gender, job)
PersonFriend (name, friend, year)
Please answer with SQL.
assistant
Sure, I understand.
human
What is the minimum age?
assistant
SELECT MIN( age ) FROM person;
human
Who has it?
assistant
SELECT name FROM person WHERE age = ( SELECT MIN( age ) FROM person );
human
What is the average age?
assistant
SELECT AVG ( age ) FROM person;
human
Who is younger than this?
assistant
SELECT name FROM person WHERE age < ( SELECT AVG ( age ) FROM person );
human
Who calls these people friends?
assistant
SELECT DISTINCT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.age < ( SELECT AVG ( age ) FROM person ) ;