CREATE TABLE people (
    People_ID NUMBER PRIMARY KEY,
    Age NUMBER,
    Name TEXT,
    Nationality TEXT,
    Graduation_College TEXT
);
CREATE TABLE company (
    Company_ID NUMBER PRIMARY KEY,
    Name TEXT,
    Headquarters TEXT,
    Industry TEXT,
    Sales_in_Billion NUMBER,
    Profits_in_Billion NUMBER,
    Assets_in_Billion NUMBER,
    Market_Value_in_Billion NUMBER
);
CREATE TABLE employment (
    Company_ID NUMBER PRIMARY KEY,
    People_ID NUMBER,
    Year_working NUMBER,
    FOREIGN KEY ("People_ID") REFERENCES people("People_ID"),
    FOREIGN KEY ("Company_ID") REFERENCES company("Company_ID")
);

Question: How many companies are headquartered in the US?
SQL: SELECT count(*) FROM company WHERE Headquarters  =  'USA'

Question: List the names of companies by ascending number of sales.
SQL: SELECT Name FROM company ORDER BY Sales_in_Billion ASC

Question: What are the headquarters and industries of all companies?
SQL: SELECT Headquarters ,  Industry FROM company

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 different headquarters and number of companies at each headquarter.
SQL: SELECT Headquarters ,  COUNT(*) FROM company GROUP BY Headquarters

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)

Question: list the names of the companies with more than 200 sales in the descending order of sales and profits.
SQL: SELECT name FROM company WHERE Sales_in_Billion  >  200 ORDER BY Sales_in_Billion ,  Profits_in_Billion DESC