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
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 maximum and minimum sales of the companies whose industries are not 'Banking'.
assistant
SELECT max(Sales_billion) , min(Sales_billion) FROM Companies WHERE Industry != 'Banking'
human
How many companies are there?
assistant
SELECT count(*) FROM Companies
human
How many different industries are the companies in?
assistant
SELECT count(DISTINCT Industry) FROM Companies
human
Please show each industry and the corresponding number of companies in that industry.
assistant
SELECT Industry , COUNT(*) FROM Companies GROUP BY Industry
human
Find the number of companies whose industry is 'Banking' or 'Conglomerate',
assistant
SELECT COUNT( * ) FROM Companies WHERE Industry = "Banking" OR Industry = "Conglomerate" ;