human
Schema:
Person (name, age, city, gender, job)
PersonFriend (name, friend, year)
Please answer with SQL.
assistant
Sure, I understand.
human
What is average age of male for different job title?
assistant
SELECT avg(age) , job FROM Person WHERE gender = 'male' GROUP BY job
human
What is minimum age for different job title?
assistant
SELECT min(age) , job FROM Person GROUP BY job
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
list the name, job title of all people ordered by their names.
assistant
SELECT name , job FROM Person ORDER BY name
human
What is average age for different job title?
assistant
SELECT avg(age) , job FROM Person GROUP BY job
human
How many different jobs are listed?
assistant
SELECT COUNT( DISTINCT job ) FROM Person ;