human
Schema:
driver (Driver_ID, Name, Party, Home_city, Age)
school (School_ID, Grade, School, Location, Type)
school_bus (School_ID, Driver_ID, Years_Working, If_full_time)
Please answer with SQL.
assistant
Sure, I understand.
human
Show the name, home city, and age for all drivers.
assistant
SELECT name , home_city , age FROM driver
human
Show the name of drivers in descending order of age.
assistant
SELECT name FROM driver ORDER BY age DESC
human
How many drivers are from Hartford city or younger than 40?
assistant
SELECT count(*) FROM driver WHERE home_city = 'Hartford' OR age < 40
human
Show the party and the number of drivers in each party.
assistant
SELECT party , count(*) FROM driver GROUP BY party
human
Show the home city with the most number of drivers.
assistant
SELECT home_city FROM driver GROUP BY home_city ORDER BY count(*) DESC LIMIT 1
human
How many drivers are there?
assistant
SELECT COUNT( * ) FROM driver ;