SQL
stringlengths 18
577
| question
stringlengths 317
11.5k
|
---|---|
SELECT min(market_value) , max(market_value) , avg(market_value) FROM company
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. What is the minimum, maximum, and average market value for every company?
|
SELECT DISTINCT main_industry FROM company
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. Show all main industry for all companies.
|
SELECT DISTINCT main_industry FROM company
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. What are the different main industries for all companies?
|
SELECT headquarters , count(*) FROM company GROUP BY headquarters
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. List all headquarters and the number of companies in each headquarter.
|
SELECT headquarters , count(*) FROM company GROUP BY headquarters
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. For each headquarter, what are the headquarter and how many companies are centered there?
|
SELECT main_industry , sum(market_value) FROM company GROUP BY main_industry
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. Show all main industry and total market value in each industry.
|
SELECT main_industry , sum(market_value) FROM company GROUP BY main_industry
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. What are the main indstries and total market value for each industry?
|
SELECT main_industry , count(*) FROM company GROUP BY main_industry ORDER BY sum(market_value) DESC LIMIT 1
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. List the main industry with highest total market value and its number of companies.
|
SELECT main_industry , count(*) FROM company GROUP BY main_industry ORDER BY sum(market_value) DESC LIMIT 1
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. For each main industry, what is the total number of companies for the industry with the highest total market value?
|
SELECT headquarters FROM company WHERE main_industry = 'Banking' GROUP BY headquarters HAVING count(*) >= 2
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. Show headquarters with at least two companies in the banking industry.
|
SELECT headquarters FROM company WHERE main_industry = 'Banking' GROUP BY headquarters HAVING count(*) >= 2
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. What are the headquarters with at least two companies in the banking industry?
|
SELECT station_id , LOCATION , manager_name FROM gas_station ORDER BY open_year
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. Show gas station id, location, and manager_name for all gas stations ordered by open year.
|
SELECT station_id , LOCATION , manager_name FROM gas_station ORDER BY open_year
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. What are the gas station ids, locations, and manager names for the gas stations ordered by opening year?
|
SELECT count(*) FROM gas_station WHERE open_year BETWEEN 2000 AND 2005
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. How many gas station are opened between 2000 and 2005?
|
SELECT count(*) FROM gas_station WHERE open_year BETWEEN 2000 AND 2005
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. What is the total number of gas stations that opened between 2000 and 2005?
|
SELECT LOCATION , count(*) FROM gas_station GROUP BY LOCATION ORDER BY count(*)
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. Show all locations and the number of gas stations in each location ordered by the count.
|
SELECT LOCATION , count(*) FROM gas_station GROUP BY LOCATION ORDER BY count(*)
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. For each location, how many gas stations are there in order?
|
SELECT headquarters FROM company WHERE main_industry = 'Banking' INTERSECT SELECT headquarters FROM company WHERE main_industry = 'Oil and gas'
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. Show all headquarters with both a company in banking industry and a company in Oil and gas.
|
SELECT headquarters FROM company WHERE main_industry = 'Banking' INTERSECT SELECT headquarters FROM company WHERE main_industry = 'Oil and gas'
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. What are the headquarters that have both a company in the banking and 'oil and gas' industries?
|
SELECT headquarters FROM company EXCEPT SELECT headquarters FROM company WHERE main_industry = 'Banking'
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. Show all headquarters without a company in banking industry.
|
SELECT headquarters FROM company EXCEPT SELECT headquarters FROM company WHERE main_industry = 'Banking'
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. What are the headquarters without companies that are in the banking industry?
|
SELECT T2.company , count(*) FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id GROUP BY T1.company_id
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. Show the company name with the number of gas station.
|
SELECT T2.company , count(*) FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id GROUP BY T1.company_id
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. For each company id, what are the companies and how many gas stations does each one operate?
|
SELECT company , main_industry FROM company WHERE company_id NOT IN (SELECT company_id FROM station_company)
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. Show company name and main industry without a gas station.
|
SELECT company , main_industry FROM company WHERE company_id NOT IN (SELECT company_id FROM station_company)
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. What are the main industries of the companies without gas stations and what are the companies?
|
SELECT T3.manager_name FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id JOIN gas_station AS T3 ON T1.station_id = T3.station_id WHERE T2.company = 'ExxonMobil'
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. Show the manager name for gas stations belonging to the ExxonMobil company.
|
SELECT T3.manager_name FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id JOIN gas_station AS T3 ON T1.station_id = T3.station_id WHERE T2.company = 'ExxonMobil'
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. What are the names of the managers for gas stations that are operated by the ExxonMobil company?
|
SELECT T3.location FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id JOIN gas_station AS T3 ON T1.station_id = T3.station_id WHERE T2.market_value > 100
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. Show all locations where a gas station for company with market value greater than 100 is located.
|
SELECT T3.location FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id JOIN gas_station AS T3 ON T1.station_id = T3.station_id WHERE T2.market_value > 100
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. What are the locations that have gas stations owned by a company with a market value greater than 100?
|
SELECT manager_name FROM gas_station WHERE open_year > 2000 GROUP BY manager_name ORDER BY count(*) DESC LIMIT 1
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. Show the manager name with most number of gas stations opened after 2000.
|
SELECT manager_name FROM gas_station WHERE open_year > 2000 GROUP BY manager_name ORDER BY count(*) DESC LIMIT 1
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. What is the name of the manager with the most gas stations that opened after 2000?
|
SELECT LOCATION FROM gas_station ORDER BY open_year
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. order all gas station locations by the opening year.
|
SELECT LOCATION FROM gas_station ORDER BY open_year
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. What are the locations of all the gas stations ordered by opening year?
|
SELECT rank , company , market_value FROM company WHERE main_industry = 'Banking' ORDER BY sales_billion , profits_billion
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. find the rank, company names, market values of the companies in the banking industry order by their sales and profits in billion.
|
SELECT rank , company , market_value FROM company WHERE main_industry = 'Banking' ORDER BY sales_billion , profits_billion
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. What is the rank, company, and market value of every comapny in the banking industry ordered by sales and profits?
|
SELECT T3.location , T3.Representative_Name FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id JOIN gas_station AS T3 ON T1.station_id = T3.station_id ORDER BY T2.Assets_billion DESC LIMIT 3
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. find the location and Representative name of the gas stations owned by the companies with top 3 Asset amounts.
|
SELECT T3.location , T3.Representative_Name FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id JOIN gas_station AS T3 ON T1.station_id = T3.station_id ORDER BY T2.Assets_billion DESC LIMIT 3
|
Given the Table company having columns as Company_ID has datatype number, Rank has datatype number, Company has datatype text, Headquarters has datatype text, Main_Industry has datatype text, Sales_billion has datatype number, Profits_billion has datatype number, Assets_billion has datatype number, Market_Value has datatype number which has Company_ID and Given the Table gas station having columns as Station_ID has datatype number, Open_Year has datatype number, Location has datatype text, Manager_Name has datatype text, Vice_Manager_Name has datatype text, Representative_Name has datatype text which has Station_ID and Given the Table station company having columns as Station_ID has datatype number, Company_ID has datatype number, Rank_of_the_Year has datatype number which has Station_ID. Answer the question by writing the appropriate SQL code. What are the locations and representatives' names of the gas stations owned by the companies with the 3 largest amounts of assets?
|
SELECT count(*) FROM region
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. How many regions do we have?
|
SELECT count(*) FROM region
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. Count the number of regions.
|
SELECT DISTINCT region_name FROM region ORDER BY Label
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. Show all distinct region names ordered by their labels.
|
SELECT DISTINCT region_name FROM region ORDER BY Label
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. What are the different region names, ordered by labels?
|
SELECT count(DISTINCT party_name) FROM party
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. How many parties do we have?
|
SELECT count(DISTINCT party_name) FROM party
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. Count the number of different parties.
|
SELECT minister , took_office , left_office FROM party ORDER BY left_office
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. Show the ministers and the time they took and left office, listed by the time they left office.
|
SELECT minister , took_office , left_office FROM party ORDER BY left_office
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. Who are the ministers, when did they take office, and when did they leave office, ordered by when they left office?
|
SELECT minister FROM party WHERE took_office > 1961 OR took_office < 1959
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. Show the minister who took office after 1961 or before 1959.
|
SELECT minister FROM party WHERE took_office > 1961 OR took_office < 1959
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. Who are the ministers who took office after 1961 or before 1959?
|
SELECT minister FROM party WHERE party_name != 'Progress Party'
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. Show all ministers who do not belong to Progress Party.
|
SELECT minister FROM party WHERE party_name != 'Progress Party'
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. Which ministers are not a part of the Progress Party?
|
SELECT minister , party_name FROM party ORDER BY took_office DESC
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. Show all ministers and parties they belong to in descending order of the time they took office.
|
SELECT minister , party_name FROM party ORDER BY took_office DESC
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. Who are the ministers and what parties do they belong to, listed descending by the times they took office?
|
SELECT minister FROM party ORDER BY left_office DESC LIMIT 1
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. Return the minister who left office at the latest time.
|
SELECT minister FROM party ORDER BY left_office DESC LIMIT 1
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. Which minister left office the latest?
|
SELECT T1.member_name , T2.party_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. List member names and their party names.
|
SELECT T1.member_name , T2.party_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. What are the names of members and their corresponding parties?
|
SELECT T2.party_name , count(*) FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. Show all party names and the number of members in each party.
|
SELECT T2.party_name , count(*) FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. How many members are in each party?
|
SELECT T2.party_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id ORDER BY count(*) DESC LIMIT 1
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. What is the name of party with most number of members?
|
SELECT T2.party_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id ORDER BY count(*) DESC LIMIT 1
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. Return the name of the party with the most members.
|
SELECT T1.party_name , T2.region_name FROM party AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. Show all party names and their region names.
|
SELECT T1.party_name , T2.region_name FROM party AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. What are the names of parties and their respective regions?
|
SELECT party_name FROM party WHERE party_id NOT IN (SELECT party_id FROM Member)
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. Show names of parties that does not have any members.
|
SELECT party_name FROM party WHERE party_id NOT IN (SELECT party_id FROM Member)
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. What are the names of parties that have no members?
|
SELECT member_name FROM member WHERE party_id = 3 INTERSECT SELECT member_name FROM member WHERE party_id = 1
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. Show the member names which are in both the party with id 3 and the party with id 1.
|
SELECT member_name FROM member WHERE party_id = 3 INTERSECT SELECT member_name FROM member WHERE party_id = 1
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. Which member names are shared among members in the party with the id 3 and the party with the id 1?
|
SELECT T1.member_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id WHERE T2.Party_name != "Progress Party"
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. Show member names that are not in the Progress Party.
|
SELECT T1.member_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id WHERE T2.Party_name != "Progress Party"
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. Which member names corresponding to members who are not in the Progress Party?
|
SELECT count(*) FROM party_events
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. How many party events do we have?
|
SELECT count(*) FROM party_events
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. Count the number of party events.
|
SELECT T2.party_name , count(*) FROM party_events AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. Show party names and the number of events for each party.
|
SELECT T2.party_name , count(*) FROM party_events AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. How many events are there for each party?
|
SELECT member_name FROM member EXCEPT SELECT T1.member_name FROM member AS T1 JOIN party_events AS T2 ON T1.member_id = T2.member_in_charge_id
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. Show all member names who are not in charge of any event.
|
SELECT member_name FROM member EXCEPT SELECT T1.member_name FROM member AS T1 JOIN party_events AS T2 ON T1.member_id = T2.member_in_charge_id
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. What are the names of members who are not in charge of any events?
|
SELECT T2.party_name FROM party_events AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id HAVING count(*) >= 2
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. What are the names of parties with at least 2 events?
|
SELECT T2.party_name FROM party_events AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id HAVING count(*) >= 2
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. Return the names of parties that have two or more events.
|
SELECT T1.member_name FROM member AS T1 JOIN party_events AS T2 ON T1.member_id = T2.member_in_charge_id GROUP BY T2.member_in_charge_id ORDER BY count(*) DESC LIMIT 1
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. What is the name of member in charge of greatest number of events?
|
SELECT T1.member_name FROM member AS T1 JOIN party_events AS T2 ON T1.member_id = T2.member_in_charge_id GROUP BY T2.member_in_charge_id ORDER BY count(*) DESC LIMIT 1
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. Return the name of the member who is in charge of the most events.
|
SELECT event_name FROM party_events GROUP BY event_name HAVING count(*) > 2
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. find the event names that have more than 2 records.
|
SELECT event_name FROM party_events GROUP BY event_name HAVING count(*) > 2
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. Which event names were used more than twice for party events?
|
SELECT count(*) FROM region AS t1 JOIN party AS t2 ON t1.region_id = t2.region_id JOIN party_events AS t3 ON t2.party_id = t3.party_id WHERE t1.region_name = "United Kingdom" AND t3.Event_Name = "Annaual Meeting"
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. How many Annual Meeting events happened in the United Kingdom region?
|
SELECT count(*) FROM region AS t1 JOIN party AS t2 ON t1.region_id = t2.region_id JOIN party_events AS t3 ON t2.party_id = t3.party_id WHERE t1.region_name = "United Kingdom" AND t3.Event_Name = "Annaual Meeting"
|
Given the Table region having columns as Region_ID has datatype number, Region_name has datatype text, Date has datatype text, Label has datatype text, Format has datatype text, Catalogue has datatype text which has Region_ID and Given the Table party having columns as Party_ID has datatype number, Minister has datatype text, Took_office has datatype text, Left_office has datatype text, Region_ID has datatype number, Party_name has datatype text which has Party_ID and Given the Table member having columns as Member_ID has datatype number, Member_Name has datatype text, Party_ID has datatype text, In_office has datatype text which has Member_ID and Given the Table party events having columns as Event_ID has datatype number, Event_Name has datatype text, Party_ID has datatype number, Member_in_charge_ID has datatype number which has Event_ID. Answer the question by writing the appropriate SQL code. Count the number of Annual Meeting events that took place in the region of the United Kingdom.
|
SELECT count(*) FROM pilot
|
Given the Table aircraft having columns as Aircraft_ID has datatype number, Order_Year has datatype number, Manufacturer has datatype text, Model has datatype text, Fleet_Series has datatype text, Powertrain has datatype text, Fuel_Propulsion has datatype text which has Aircraft_ID and Given the Table pilot having columns as Pilot_ID has datatype number, Pilot_name has datatype text, Rank has datatype number, Age has datatype number, Nationality has datatype text, Position has datatype text, Join_Year has datatype number, Team has datatype text which has Pilot_ID and Given the Table pilot record having columns as Record_ID has datatype number, Pilot_ID has datatype number, Aircraft_ID has datatype number, Date has datatype text which has Pilot_ID. Answer the question by writing the appropriate SQL code. How many pilots are there?
|
SELECT Pilot_name FROM pilot ORDER BY Rank ASC
|
Given the Table aircraft having columns as Aircraft_ID has datatype number, Order_Year has datatype number, Manufacturer has datatype text, Model has datatype text, Fleet_Series has datatype text, Powertrain has datatype text, Fuel_Propulsion has datatype text which has Aircraft_ID and Given the Table pilot having columns as Pilot_ID has datatype number, Pilot_name has datatype text, Rank has datatype number, Age has datatype number, Nationality has datatype text, Position has datatype text, Join_Year has datatype number, Team has datatype text which has Pilot_ID and Given the Table pilot record having columns as Record_ID has datatype number, Pilot_ID has datatype number, Aircraft_ID has datatype number, Date has datatype text which has Pilot_ID. Answer the question by writing the appropriate SQL code. List the names of pilots in ascending order of rank.
|
SELECT POSITION , Team FROM pilot
|
Given the Table aircraft having columns as Aircraft_ID has datatype number, Order_Year has datatype number, Manufacturer has datatype text, Model has datatype text, Fleet_Series has datatype text, Powertrain has datatype text, Fuel_Propulsion has datatype text which has Aircraft_ID and Given the Table pilot having columns as Pilot_ID has datatype number, Pilot_name has datatype text, Rank has datatype number, Age has datatype number, Nationality has datatype text, Position has datatype text, Join_Year has datatype number, Team has datatype text which has Pilot_ID and Given the Table pilot record having columns as Record_ID has datatype number, Pilot_ID has datatype number, Aircraft_ID has datatype number, Date has datatype text which has Pilot_ID. Answer the question by writing the appropriate SQL code. What are the positions and teams of pilots?
|
SELECT DISTINCT POSITION FROM pilot WHERE Age > 30
|
Given the Table aircraft having columns as Aircraft_ID has datatype number, Order_Year has datatype number, Manufacturer has datatype text, Model has datatype text, Fleet_Series has datatype text, Powertrain has datatype text, Fuel_Propulsion has datatype text which has Aircraft_ID and Given the Table pilot having columns as Pilot_ID has datatype number, Pilot_name has datatype text, Rank has datatype number, Age has datatype number, Nationality has datatype text, Position has datatype text, Join_Year has datatype number, Team has datatype text which has Pilot_ID and Given the Table pilot record having columns as Record_ID has datatype number, Pilot_ID has datatype number, Aircraft_ID has datatype number, Date has datatype text which has Pilot_ID. Answer the question by writing the appropriate SQL code. List the distinct positions of pilots older than 30.
|
SELECT Pilot_name FROM pilot WHERE Team = "Bradley" OR Team = "Fordham"
|
Given the Table aircraft having columns as Aircraft_ID has datatype number, Order_Year has datatype number, Manufacturer has datatype text, Model has datatype text, Fleet_Series has datatype text, Powertrain has datatype text, Fuel_Propulsion has datatype text which has Aircraft_ID and Given the Table pilot having columns as Pilot_ID has datatype number, Pilot_name has datatype text, Rank has datatype number, Age has datatype number, Nationality has datatype text, Position has datatype text, Join_Year has datatype number, Team has datatype text which has Pilot_ID and Given the Table pilot record having columns as Record_ID has datatype number, Pilot_ID has datatype number, Aircraft_ID has datatype number, Date has datatype text which has Pilot_ID. Answer the question by writing the appropriate SQL code. Show the names of pilots from team "Bradley" or "Fordham".
|
SELECT Join_Year FROM pilot ORDER BY Rank ASC LIMIT 1
|
Given the Table aircraft having columns as Aircraft_ID has datatype number, Order_Year has datatype number, Manufacturer has datatype text, Model has datatype text, Fleet_Series has datatype text, Powertrain has datatype text, Fuel_Propulsion has datatype text which has Aircraft_ID and Given the Table pilot having columns as Pilot_ID has datatype number, Pilot_name has datatype text, Rank has datatype number, Age has datatype number, Nationality has datatype text, Position has datatype text, Join_Year has datatype number, Team has datatype text which has Pilot_ID and Given the Table pilot record having columns as Record_ID has datatype number, Pilot_ID has datatype number, Aircraft_ID has datatype number, Date has datatype text which has Pilot_ID. Answer the question by writing the appropriate SQL code. What is the joined year of the pilot of the highest rank?
|
SELECT Nationality , COUNT(*) FROM pilot GROUP BY Nationality
|
Given the Table aircraft having columns as Aircraft_ID has datatype number, Order_Year has datatype number, Manufacturer has datatype text, Model has datatype text, Fleet_Series has datatype text, Powertrain has datatype text, Fuel_Propulsion has datatype text which has Aircraft_ID and Given the Table pilot having columns as Pilot_ID has datatype number, Pilot_name has datatype text, Rank has datatype number, Age has datatype number, Nationality has datatype text, Position has datatype text, Join_Year has datatype number, Team has datatype text which has Pilot_ID and Given the Table pilot record having columns as Record_ID has datatype number, Pilot_ID has datatype number, Aircraft_ID has datatype number, Date has datatype text which has Pilot_ID. Answer the question by writing the appropriate SQL code. What are the different nationalities of pilots? Show each nationality and the number of pilots of each nationality.
|
SELECT Nationality FROM pilot GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1
|
Given the Table aircraft having columns as Aircraft_ID has datatype number, Order_Year has datatype number, Manufacturer has datatype text, Model has datatype text, Fleet_Series has datatype text, Powertrain has datatype text, Fuel_Propulsion has datatype text which has Aircraft_ID and Given the Table pilot having columns as Pilot_ID has datatype number, Pilot_name has datatype text, Rank has datatype number, Age has datatype number, Nationality has datatype text, Position has datatype text, Join_Year has datatype number, Team has datatype text which has Pilot_ID and Given the Table pilot record having columns as Record_ID has datatype number, Pilot_ID has datatype number, Aircraft_ID has datatype number, Date has datatype text which has Pilot_ID. Answer the question by writing the appropriate SQL code. Show the most common nationality of pilots.
|
SELECT POSITION FROM pilot WHERE Join_Year < 2000 INTERSECT SELECT POSITION FROM pilot WHERE Join_Year > 2005
|
Given the Table aircraft having columns as Aircraft_ID has datatype number, Order_Year has datatype number, Manufacturer has datatype text, Model has datatype text, Fleet_Series has datatype text, Powertrain has datatype text, Fuel_Propulsion has datatype text which has Aircraft_ID and Given the Table pilot having columns as Pilot_ID has datatype number, Pilot_name has datatype text, Rank has datatype number, Age has datatype number, Nationality has datatype text, Position has datatype text, Join_Year has datatype number, Team has datatype text which has Pilot_ID and Given the Table pilot record having columns as Record_ID has datatype number, Pilot_ID has datatype number, Aircraft_ID has datatype number, Date has datatype text which has Pilot_ID. Answer the question by writing the appropriate SQL code. Show the pilot positions that have both pilots joining after year 2005 and pilots joining before 2000.
|
SELECT T3.Pilot_name , T2.Model FROM pilot_record AS T1 JOIN aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN pilot AS T3 ON T1.Pilot_ID = T3.Pilot_ID
|
Given the Table aircraft having columns as Aircraft_ID has datatype number, Order_Year has datatype number, Manufacturer has datatype text, Model has datatype text, Fleet_Series has datatype text, Powertrain has datatype text, Fuel_Propulsion has datatype text which has Aircraft_ID and Given the Table pilot having columns as Pilot_ID has datatype number, Pilot_name has datatype text, Rank has datatype number, Age has datatype number, Nationality has datatype text, Position has datatype text, Join_Year has datatype number, Team has datatype text which has Pilot_ID and Given the Table pilot record having columns as Record_ID has datatype number, Pilot_ID has datatype number, Aircraft_ID has datatype number, Date has datatype text which has Pilot_ID. Answer the question by writing the appropriate SQL code. Show the names of pilots and models of aircrafts they have flied with.
|
SELECT T3.Pilot_name , T2.Fleet_Series FROM pilot_record AS T1 JOIN aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN pilot AS T3 ON T1.Pilot_ID = T3.Pilot_ID ORDER BY T3.Rank
|
Given the Table aircraft having columns as Aircraft_ID has datatype number, Order_Year has datatype number, Manufacturer has datatype text, Model has datatype text, Fleet_Series has datatype text, Powertrain has datatype text, Fuel_Propulsion has datatype text which has Aircraft_ID and Given the Table pilot having columns as Pilot_ID has datatype number, Pilot_name has datatype text, Rank has datatype number, Age has datatype number, Nationality has datatype text, Position has datatype text, Join_Year has datatype number, Team has datatype text which has Pilot_ID and Given the Table pilot record having columns as Record_ID has datatype number, Pilot_ID has datatype number, Aircraft_ID has datatype number, Date has datatype text which has Pilot_ID. Answer the question by writing the appropriate SQL code. Show the names of pilots and fleet series of the aircrafts they have flied with in ascending order of the rank of the pilot.
|
SELECT T2.Fleet_Series FROM pilot_record AS T1 JOIN aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN pilot AS T3 ON T1.Pilot_ID = T3.Pilot_ID WHERE T3.Age < 34
|
Given the Table aircraft having columns as Aircraft_ID has datatype number, Order_Year has datatype number, Manufacturer has datatype text, Model has datatype text, Fleet_Series has datatype text, Powertrain has datatype text, Fuel_Propulsion has datatype text which has Aircraft_ID and Given the Table pilot having columns as Pilot_ID has datatype number, Pilot_name has datatype text, Rank has datatype number, Age has datatype number, Nationality has datatype text, Position has datatype text, Join_Year has datatype number, Team has datatype text which has Pilot_ID and Given the Table pilot record having columns as Record_ID has datatype number, Pilot_ID has datatype number, Aircraft_ID has datatype number, Date has datatype text which has Pilot_ID. Answer the question by writing the appropriate SQL code. Show the fleet series of the aircrafts flied by pilots younger than 34
|
SELECT T2.Pilot_name , COUNT(*) FROM pilot_record AS T1 JOIN pilot AS T2 ON T1.pilot_ID = T2.pilot_ID GROUP BY T2.Pilot_name
|
Given the Table aircraft having columns as Aircraft_ID has datatype number, Order_Year has datatype number, Manufacturer has datatype text, Model has datatype text, Fleet_Series has datatype text, Powertrain has datatype text, Fuel_Propulsion has datatype text which has Aircraft_ID and Given the Table pilot having columns as Pilot_ID has datatype number, Pilot_name has datatype text, Rank has datatype number, Age has datatype number, Nationality has datatype text, Position has datatype text, Join_Year has datatype number, Team has datatype text which has Pilot_ID and Given the Table pilot record having columns as Record_ID has datatype number, Pilot_ID has datatype number, Aircraft_ID has datatype number, Date has datatype text which has Pilot_ID. Answer the question by writing the appropriate SQL code. Show the names of pilots and the number of records they have.
|
SELECT T2.Pilot_name , COUNT(*) FROM pilot_record AS T1 JOIN pilot AS T2 ON T1.pilot_ID = T2.pilot_ID GROUP BY T2.Pilot_name HAVING COUNT(*) > 1
|
Given the Table aircraft having columns as Aircraft_ID has datatype number, Order_Year has datatype number, Manufacturer has datatype text, Model has datatype text, Fleet_Series has datatype text, Powertrain has datatype text, Fuel_Propulsion has datatype text which has Aircraft_ID and Given the Table pilot having columns as Pilot_ID has datatype number, Pilot_name has datatype text, Rank has datatype number, Age has datatype number, Nationality has datatype text, Position has datatype text, Join_Year has datatype number, Team has datatype text which has Pilot_ID and Given the Table pilot record having columns as Record_ID has datatype number, Pilot_ID has datatype number, Aircraft_ID has datatype number, Date has datatype text which has Pilot_ID. Answer the question by writing the appropriate SQL code. Show names of pilots that have more than one record.
|
SELECT Pilot_name FROM pilot WHERE Pilot_ID NOT IN (SELECT Pilot_ID FROM pilot_record)
|
Given the Table aircraft having columns as Aircraft_ID has datatype number, Order_Year has datatype number, Manufacturer has datatype text, Model has datatype text, Fleet_Series has datatype text, Powertrain has datatype text, Fuel_Propulsion has datatype text which has Aircraft_ID and Given the Table pilot having columns as Pilot_ID has datatype number, Pilot_name has datatype text, Rank has datatype number, Age has datatype number, Nationality has datatype text, Position has datatype text, Join_Year has datatype number, Team has datatype text which has Pilot_ID and Given the Table pilot record having columns as Record_ID has datatype number, Pilot_ID has datatype number, Aircraft_ID has datatype number, Date has datatype text which has Pilot_ID. Answer the question by writing the appropriate SQL code. List the names of pilots that do not have any record.
|
SELECT document_status_code FROM Ref_Document_Status;
|
Given the Table reference document types having columns as document_type_code has datatype text, document_type_description has datatype text which has document_type_code and Given the Table roles having columns as role_code has datatype text, role_description has datatype text which has role_code and Given the Table addresses having columns as address_id has datatype number, address_details has datatype text which has address_id and Given the Table reference document status having columns as document_status_code has datatype text, document_status_description has datatype text which has document_status_code and Given the Table reference shipping agents having columns as shipping_agent_code has datatype text, shipping_agent_name has datatype text, shipping_agent_description has datatype text which has shipping_agent_code and Given the Table documents having columns as document_id has datatype number, document_status_code has datatype text, document_type_code has datatype text, shipping_agent_code has datatype text, receipt_date has datatype time, receipt_number has datatype text, other_details has datatype text which has document_id and Given the Table employees having columns as employee_id has datatype number, role_code has datatype text, employee_name has datatype text, other_details has datatype text which has employee_id and Given the Table document drafts having columns as document_id has datatype number, draft_number has datatype number, draft_details has datatype text which has document_id and Given the Table draft copies having columns as document_id has datatype number, draft_number has datatype number, copy_number has datatype number which has document_id and Given the Table circulation history having columns as document_id has datatype number, draft_number has datatype number, copy_number has datatype number, employee_id has datatype number which has document_id and Given the Table documents mailed having columns as document_id has datatype number, mailed_to_address_id has datatype number, mailing_date has datatype time which has document_id. Answer the question by writing the appropriate SQL code. What document status codes do we have?
|
SELECT document_status_description FROM Ref_Document_Status WHERE document_status_code = "working";
|
Given the Table reference document types having columns as document_type_code has datatype text, document_type_description has datatype text which has document_type_code and Given the Table roles having columns as role_code has datatype text, role_description has datatype text which has role_code and Given the Table addresses having columns as address_id has datatype number, address_details has datatype text which has address_id and Given the Table reference document status having columns as document_status_code has datatype text, document_status_description has datatype text which has document_status_code and Given the Table reference shipping agents having columns as shipping_agent_code has datatype text, shipping_agent_name has datatype text, shipping_agent_description has datatype text which has shipping_agent_code and Given the Table documents having columns as document_id has datatype number, document_status_code has datatype text, document_type_code has datatype text, shipping_agent_code has datatype text, receipt_date has datatype time, receipt_number has datatype text, other_details has datatype text which has document_id and Given the Table employees having columns as employee_id has datatype number, role_code has datatype text, employee_name has datatype text, other_details has datatype text which has employee_id and Given the Table document drafts having columns as document_id has datatype number, draft_number has datatype number, draft_details has datatype text which has document_id and Given the Table draft copies having columns as document_id has datatype number, draft_number has datatype number, copy_number has datatype number which has document_id and Given the Table circulation history having columns as document_id has datatype number, draft_number has datatype number, copy_number has datatype number, employee_id has datatype number which has document_id and Given the Table documents mailed having columns as document_id has datatype number, mailed_to_address_id has datatype number, mailing_date has datatype time which has document_id. Answer the question by writing the appropriate SQL code. What is the description of document status code 'working'?
|
SELECT document_type_code FROM Ref_Document_Types;
|
Given the Table reference document types having columns as document_type_code has datatype text, document_type_description has datatype text which has document_type_code and Given the Table roles having columns as role_code has datatype text, role_description has datatype text which has role_code and Given the Table addresses having columns as address_id has datatype number, address_details has datatype text which has address_id and Given the Table reference document status having columns as document_status_code has datatype text, document_status_description has datatype text which has document_status_code and Given the Table reference shipping agents having columns as shipping_agent_code has datatype text, shipping_agent_name has datatype text, shipping_agent_description has datatype text which has shipping_agent_code and Given the Table documents having columns as document_id has datatype number, document_status_code has datatype text, document_type_code has datatype text, shipping_agent_code has datatype text, receipt_date has datatype time, receipt_number has datatype text, other_details has datatype text which has document_id and Given the Table employees having columns as employee_id has datatype number, role_code has datatype text, employee_name has datatype text, other_details has datatype text which has employee_id and Given the Table document drafts having columns as document_id has datatype number, draft_number has datatype number, draft_details has datatype text which has document_id and Given the Table draft copies having columns as document_id has datatype number, draft_number has datatype number, copy_number has datatype number which has document_id and Given the Table circulation history having columns as document_id has datatype number, draft_number has datatype number, copy_number has datatype number, employee_id has datatype number which has document_id and Given the Table documents mailed having columns as document_id has datatype number, mailed_to_address_id has datatype number, mailing_date has datatype time which has document_id. Answer the question by writing the appropriate SQL code. What document type codes do we have?
|
SELECT document_type_description FROM Ref_Document_Types WHERE document_type_code = "Paper";
|
Given the Table reference document types having columns as document_type_code has datatype text, document_type_description has datatype text which has document_type_code and Given the Table roles having columns as role_code has datatype text, role_description has datatype text which has role_code and Given the Table addresses having columns as address_id has datatype number, address_details has datatype text which has address_id and Given the Table reference document status having columns as document_status_code has datatype text, document_status_description has datatype text which has document_status_code and Given the Table reference shipping agents having columns as shipping_agent_code has datatype text, shipping_agent_name has datatype text, shipping_agent_description has datatype text which has shipping_agent_code and Given the Table documents having columns as document_id has datatype number, document_status_code has datatype text, document_type_code has datatype text, shipping_agent_code has datatype text, receipt_date has datatype time, receipt_number has datatype text, other_details has datatype text which has document_id and Given the Table employees having columns as employee_id has datatype number, role_code has datatype text, employee_name has datatype text, other_details has datatype text which has employee_id and Given the Table document drafts having columns as document_id has datatype number, draft_number has datatype number, draft_details has datatype text which has document_id and Given the Table draft copies having columns as document_id has datatype number, draft_number has datatype number, copy_number has datatype number which has document_id and Given the Table circulation history having columns as document_id has datatype number, draft_number has datatype number, copy_number has datatype number, employee_id has datatype number which has document_id and Given the Table documents mailed having columns as document_id has datatype number, mailed_to_address_id has datatype number, mailing_date has datatype time which has document_id. Answer the question by writing the appropriate SQL code. What is the description of document type 'Paper'?
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.