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
find the location and Representative name of the gas stations owned by the companies with top 3 Asset amounts.
assistant
SELECT T3.location , T3.Representative_Name FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id JOIN gas_station AS T3 ON T1.station_id = T3.station_id ORDER BY T2.Assets_billion DESC LIMIT 3
human
Show company name and main industry without a gas station.
assistant
SELECT company , main_industry FROM company WHERE company_id NOT IN (SELECT company_id FROM station_company)
human
Show the manager name with most number of gas stations opened after 2000.
assistant
SELECT manager_name FROM gas_station WHERE open_year > 2000 GROUP BY manager_name ORDER BY count(*) DESC LIMIT 1
human
Show gas station id, location, and manager_name for all gas stations ordered by open year.
assistant
SELECT station_id , LOCATION , manager_name FROM gas_station ORDER BY open_year
human
Show the company name with the number of gas station.
assistant
SELECT T2.company , count(*) FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id GROUP BY T1.company_id
human
Show the manager name for gas stations belonging to the ExxonMobil company.
assistant
SELECT T3.manager_name FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id JOIN gas_station AS T3 ON T1.station_id = T3.station_id WHERE T2.company = "ExxonMobil" ;