Database: company_employee

Question: Show the names of companies in the banking or retailing industry?
SQL: SELECT Name FROM company WHERE Industry  =  "Banking" OR Industry  =  "Retailing"

Question: What is the maximum and minimum market value of companies?
SQL: SELECT max(Market_Value_in_Billion) ,  min(Market_Value_in_Billion) FROM company

Question: What is the headquarter of the company with the largest sales?
SQL: SELECT Headquarters FROM company ORDER BY Sales_in_Billion DESC LIMIT 1

Question: Show the most common headquarter for companies.
SQL: SELECT Headquarters FROM company GROUP BY Headquarters ORDER BY COUNT(*) DESC LIMIT 1

Question: Show the headquarters that have at least two companies.
SQL: SELECT Headquarters FROM company GROUP BY Headquarters HAVING COUNT(*)  >=  2

Question: Show the headquarters that have both companies in banking industry and companies in oil and gas industry.
SQL: SELECT Headquarters FROM company WHERE Industry  =  "Banking" INTERSECT SELECT Headquarters FROM company WHERE Industry  =  "Oil and gas"

Question: Show the names of companies and of employees.
SQL: SELECT T3.Name ,  T2.Name FROM employment AS T1 JOIN people AS T2 ON T1.People_ID  =  T2.People_ID JOIN company AS T3 ON T1.Company_ID  =  T3.Company_ID

Question: Show names of companies and that of employees in descending order of number of years working for that employee.
SQL: SELECT T3.Name ,  T2.Name FROM employment AS T1 JOIN people AS T2 ON T1.People_ID  =  T2.People_ID JOIN company AS T3 ON T1.Company_ID  =  T3.Company_ID ORDER BY T1.Year_working

Question: Show the names of employees that work for companies with sales bigger than 200.
SQL: SELECT T2.Name FROM employment AS T1 JOIN people AS T2 ON T1.People_ID  =  T2.People_ID JOIN company AS T3 ON T1.Company_ID  =  T3.Company_ID WHERE T3.Sales_in_Billion  >  200

Question: Show the names of companies and the number of employees they have
SQL: SELECT T3.Name ,  COUNT(*) FROM employment AS T1 JOIN people AS T2 ON T1.People_ID  =  T2.People_ID JOIN company AS T3 ON T1.Company_ID  =  T3.Company_ID GROUP BY T3.Name

Question: List the names of people that are not employed by any company
SQL: SELECT Name FROM people WHERE People_ID NOT IN (SELECT People_ID FROM employment)