human
Schema:
Person (name, age, city, gender, job)
PersonFriend (name, friend, year)
Please answer with SQL.
assistant
Sure, I understand.
human
Find the name of people whose age is greater than any engineer sorted by their age.
assistant
SELECT name FROM Person WHERE age > (SELECT min(age) FROM person WHERE job = 'engineer') ORDER BY age
human
How many type of jobs do they have?
assistant
SELECT count(DISTINCT job) FROM Person
human
Find the name and age of all males in order of their age.
assistant
SELECT name FROM Person WHERE gender = 'male' ORDER BY age
human
Who is the oldest person whose job is student?
assistant
SELECT name FROM Person WHERE job = 'student' AND age = (SELECT max(age) FROM person WHERE job = 'student' )
human
Find the names of all person sorted in the descending order using age.
assistant
SELECT name FROM Person ORDER BY age DESC
human
What are the names and job titles of every person ordered alphabetically by name?
assistant
SELECT name , job FROM Person ORDER BY name ;