human
Schema:
Person (name, age, city, gender, job)
PersonFriend (name, friend, year)
Please answer with SQL.
assistant
Sure, I understand.
human
How many people whose age is greater 30 and job is engineer?
assistant
SELECT count(*) FROM Person WHERE age > 30 AND job = 'engineer'
human
What is the average age for all person?
assistant
SELECT avg(age) FROM Person
human
What is the average age for each gender?
assistant
SELECT avg(age) , gender FROM Person GROUP BY gender
human
What is minimum age for different job title?
assistant
SELECT min(age) , job FROM Person GROUP BY job
human
What is average age for different job title?
assistant
SELECT avg(age) , job FROM Person GROUP BY job
human
What is average age of male for different job title?
assistant
SELECT avg ( age ) , job FROM Person WHERE gender = "male" GROUP BY job ;