human
Schema:
company (Company_ID, Rank, Company, Headquarters, Main_Industry, Sales_billion, Profits_billion, Assets_billion, Market_Value)
gas_station (Station_ID, Open_Year, Location, Manager_Name, Vice_Manager_Name, Representative_Name)
station_company (Station_ID, Company_ID, Rank_of_the_Year)
Please answer with SQL.
assistant
Sure, I understand.
human
Show the manager name for all gas stations.
assistant
SELECT manager_name FROM gas_station;
human
For each of them, also count the number of gas stations opened after 2000.
assistant
SELECT manager_name , COUNT( * ) FROM gas_station WHERE open_year > 2000 GROUP BY manager_name;
human
Show the results in the descending order of their count.
assistant
SELECT manager_name , COUNT( * ) FROM gas_station WHERE open_year > 2000 GROUP BY manager_name ORDER BY COUNT( * ) DESC;
human
Which manager name has the most?
assistant
SELECT manager_name FROM gas_station WHERE open_year > 2000 GROUP BY manager_name ORDER BY COUNT( * ) DESC LIMIT 1 ;