human
Schema:
Person (name, age, city, gender, job)
PersonFriend (name, friend, year)
Please answer with SQL.
assistant
Sure, I understand.
human
Find the number of people whose age is greater than all engineers.
assistant
SELECT count(*) FROM Person WHERE age > (SELECT max(age) FROM person WHERE job = 'engineer')
human
Who is the oldest person?
assistant
SELECT name FROM Person WHERE age = (SELECT max(age) FROM person)
human
list the name, job title of all people ordered by their names.
assistant
SELECT name , job FROM Person ORDER BY name
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
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
Find the names of all person sorted in the descending order using age.
assistant
SELECT name FROM Person ORDER BY age DESC ;