human
Schema:
buildings (id, name, City, Height, Stories, Status)
Companies (id, name, Headquarters, Industry, Sales_billion, Profits_billion, Assets_billion, Market_Value_billion)
Office_locations (building_id, company_id, move_in_year)
Please answer with SQL.
assistant
Sure, I understand.
human
Show the name of the building that has the most company offices.
assistant
SELECT T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id = T2.id JOIN Companies AS T3 ON T1.company_id = T3.id GROUP BY T1.building_id ORDER BY COUNT(*) DESC LIMIT 1
human
List the industry shared by the most companies.
assistant
SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC LIMIT 1
human
Please show each industry and the corresponding number of companies in that industry.
assistant
SELECT Industry , COUNT(*) FROM Companies GROUP BY Industry
human
Please show the industries of companies in descending order of the number of companies.
assistant
SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC
human
What are the name and assets of each company, sorted in ascending order of company name?
assistant
SELECT name , Assets_billion FROM Companies ORDER BY name ASC
human
Sort the company names in descending order of the company's market value.
assistant
SELECT name FROM Companies ORDER BY Market_Value_billion DESC ;