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
Find the number of companies whose industry is 'Banking' or 'Conglomerate',
assistant
SELECT count(*) FROM Companies WHERE Industry = 'Banking' OR Industry = 'Conglomerate'
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
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
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 ;