db_id
stringlengths
3
31
query
stringlengths
18
577
question
stringlengths
3
224
schema
stringlengths
177
6.14k
primary_keys
stringlengths
16
545
foreign_keys
stringlengths
16
1.48k
gas_company
SELECT company , headquarters FROM company ORDER BY market_value DESC
What are the names and headquarters of all companies ordered by descending market value?
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT min(market_value) , max(market_value) , avg(market_value) FROM company
Show minimum, maximum, and average market value for all companies.
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT min(market_value) , max(market_value) , avg(market_value) FROM company
What is the minimum, maximum, and average market value for every company?
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT DISTINCT main_industry FROM company
Show all main industry for all companies.
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT DISTINCT main_industry FROM company
What are the different main industries for all companies?
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT headquarters , count(*) FROM company GROUP BY headquarters
List all headquarters and the number of companies in each headquarter.
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT headquarters , count(*) FROM company GROUP BY headquarters
For each headquarter, what are the headquarter and how many companies are centered there?
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT main_industry , sum(market_value) FROM company GROUP BY main_industry
Show all main industry and total market value in each industry.
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT main_industry , sum(market_value) FROM company GROUP BY main_industry
What are the main indstries and total market value for each industry?
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT main_industry , count(*) FROM company GROUP BY main_industry ORDER BY sum(market_value) DESC LIMIT 1
List the main industry with highest total market value and its number of companies.
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT main_industry , count(*) FROM company GROUP BY main_industry ORDER BY sum(market_value) DESC LIMIT 1
For each main industry, what is the total number of companies for the industry with the highest total market value?
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT headquarters FROM company WHERE main_industry = 'Banking' GROUP BY headquarters HAVING count(*) >= 2
Show headquarters with at least two companies in the banking industry.
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT headquarters FROM company WHERE main_industry = 'Banking' GROUP BY headquarters HAVING count(*) >= 2
What are the headquarters with at least two companies in the banking industry?
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT station_id , LOCATION , manager_name FROM gas_station ORDER BY open_year
Show gas station id, location, and manager_name for all gas stations ordered by open year.
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT station_id , LOCATION , manager_name FROM gas_station ORDER BY open_year
What are the gas station ids, locations, and manager names for the gas stations ordered by opening year?
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT count(*) FROM gas_station WHERE open_year BETWEEN 2000 AND 2005
How many gas station are opened between 2000 and 2005?
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT count(*) FROM gas_station WHERE open_year BETWEEN 2000 AND 2005
What is the total number of gas stations that opened between 2000 and 2005?
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT LOCATION , count(*) FROM gas_station GROUP BY LOCATION ORDER BY count(*)
Show all locations and the number of gas stations in each location ordered by the count.
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT LOCATION , count(*) FROM gas_station GROUP BY LOCATION ORDER BY count(*)
For each location, how many gas stations are there in order?
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT headquarters FROM company WHERE main_industry = 'Banking' INTERSECT SELECT headquarters FROM company WHERE main_industry = 'Oil and gas'
Show all headquarters with both a company in banking industry and a company in Oil and gas.
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT headquarters FROM company WHERE main_industry = 'Banking' INTERSECT SELECT headquarters FROM company WHERE main_industry = 'Oil and gas'
What are the headquarters that have both a company in the banking and 'oil and gas' industries?
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT headquarters FROM company EXCEPT SELECT headquarters FROM company WHERE main_industry = 'Banking'
Show all headquarters without a company in banking industry.
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT headquarters FROM company EXCEPT SELECT headquarters FROM company WHERE main_industry = 'Banking'
What are the headquarters without companies that are in the banking industry?
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
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
Show the company name with the number of gas station.
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
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
For each company id, what are the companies and how many gas stations does each one operate?
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT company , main_industry FROM company WHERE company_id NOT IN (SELECT company_id FROM station_company)
Show company name and main industry without a gas station.
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT company , main_industry FROM company WHERE company_id NOT IN (SELECT company_id FROM station_company)
What are the main industries of the companies without gas stations and what are the companies?
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_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'
Show the manager name for gas stations belonging to the ExxonMobil company.
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_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'
What are the names of the managers for gas stations that are operated by the ExxonMobil company?
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_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
Show all locations where a gas station for company with market value greater than 100 is located.
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_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
What are the locations that have gas stations owned by a company with a market value greater than 100?
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT manager_name FROM gas_station WHERE open_year > 2000 GROUP BY manager_name ORDER BY count(*) DESC LIMIT 1
Show the manager name with most number of gas stations opened after 2000.
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT manager_name FROM gas_station WHERE open_year > 2000 GROUP BY manager_name ORDER BY count(*) DESC LIMIT 1
What is the name of the manager with the most gas stations that opened after 2000?
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT LOCATION FROM gas_station ORDER BY open_year
order all gas station locations by the opening year.
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT LOCATION FROM gas_station ORDER BY open_year
What are the locations of all the gas stations ordered by opening year?
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT rank , company , market_value FROM company WHERE main_industry = 'Banking' ORDER BY sales_billion , profits_billion
find the rank, company names, market values of the companies in the banking industry order by their sales and profits in billion.
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
SELECT rank , company , market_value FROM company WHERE main_industry = 'Banking' ORDER BY sales_billion , profits_billion
What is the rank, company, and market value of every comapny in the banking industry ordered by sales and profits?
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
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
find the location and Representative name of the gas stations owned by the companies with top 3 Asset amounts.
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
gas_company
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
What are the locations and representatives' names of the gas stations owned by the companies with the 3 largest amounts of assets?
[Schema (values) (types)]: | gas_company | company : company_id (text) , rank (number) , company (number) , headquarters (text) , main_industry (text) , sales_billion (text) , profits_billion (number) , assets_billion (number) , market_value (number) | gas_station : station_id (text) , open_year (number) , location (number) , manager_name (text) , vice_manager_name (text) , representative_name (text) | station_company : station_id (text) , company_id (number) , rank_of_the_year (number);
[Primary Keys]: company : company_id, gas_station : station_id, station_company : station_id
[Foreign Keys]: station_company : company_id = company : company_id | station_company : station_id = gas_station : station_id
party_people
SELECT count(*) FROM region
How many regions do we have?
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
SELECT count(*) FROM region
Count the number of regions.
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
SELECT DISTINCT region_name FROM region ORDER BY Label
Show all distinct region names ordered by their labels.
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
SELECT DISTINCT region_name FROM region ORDER BY Label
What are the different region names, ordered by labels?
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
SELECT count(DISTINCT party_name) FROM party
How many parties do we have?
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
SELECT count(DISTINCT party_name) FROM party
Count the number of different parties.
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
SELECT minister , took_office , left_office FROM party ORDER BY left_office
Show the ministers and the time they took and left office, listed by the time they left office.
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
SELECT minister , took_office , left_office FROM party ORDER BY left_office
Who are the ministers, when did they take office, and when did they leave office, ordered by when they left office?
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
SELECT minister FROM party WHERE took_office > 1961 OR took_office < 1959
Show the minister who took office after 1961 or before 1959.
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
SELECT minister FROM party WHERE took_office > 1961 OR took_office < 1959
Who are the ministers who took office after 1961 or before 1959?
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
SELECT minister FROM party WHERE party_name != 'Progress Party'
Show all ministers who do not belong to Progress Party.
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
SELECT minister FROM party WHERE party_name != 'Progress Party'
Which ministers are not a part of the Progress Party?
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
SELECT minister , party_name FROM party ORDER BY took_office DESC
Show all ministers and parties they belong to in descending order of the time they took office.
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
SELECT minister , party_name FROM party ORDER BY took_office DESC
Who are the ministers and what parties do they belong to, listed descending by the times they took office?
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
SELECT minister FROM party ORDER BY left_office DESC LIMIT 1
Return the minister who left office at the latest time.
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
SELECT minister FROM party ORDER BY left_office DESC LIMIT 1
Which minister left office the latest?
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
SELECT T1.member_name , T2.party_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id
List member names and their party names.
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
SELECT T1.member_name , T2.party_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id
What are the names of members and their corresponding parties?
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
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
Show all party names and the number of members in each party.
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
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
How many members are in each party?
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
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
What is the name of party with most number of members?
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
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
Return the name of the party with the most members.
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
SELECT T1.party_name , T2.region_name FROM party AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id
Show all party names and their region names.
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
SELECT T1.party_name , T2.region_name FROM party AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id
What are the names of parties and their respective regions?
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
SELECT party_name FROM party WHERE party_id NOT IN (SELECT party_id FROM Member)
Show names of parties that does not have any members.
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
SELECT party_name FROM party WHERE party_id NOT IN (SELECT party_id FROM Member)
What are the names of parties that have no members?
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
SELECT member_name FROM member WHERE party_id = 3 INTERSECT SELECT member_name FROM member WHERE party_id = 1
Show the member names which are in both the party with id 3 and the party with id 1.
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
SELECT member_name FROM member WHERE party_id = 3 INTERSECT SELECT member_name FROM member WHERE party_id = 1
Which member names are shared among members in the party with the id 3 and the party with the id 1?
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
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"
Show member names that are not in the Progress Party.
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
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"
Which member names corresponding to members who are not in the Progress Party?
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
SELECT count(*) FROM party_events
How many party events do we have?
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
SELECT count(*) FROM party_events
Count the number of party events.
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
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
Show party names and the number of events for each party.
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
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
How many events are there for each party?
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
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
Show all member names who are not in charge of any event.
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
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
What are the names of members who are not in charge of any events?
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
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
What are the names of parties with at least 2 events?
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
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
Return the names of parties that have two or more events.
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
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
What is the name of member in charge of greatest number of events?
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
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
Return the name of the member who is in charge of the most events.
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
SELECT event_name FROM party_events GROUP BY event_name HAVING count(*) > 2
find the event names that have more than 2 records.
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
SELECT event_name FROM party_events GROUP BY event_name HAVING count(*) > 2
Which event names were used more than twice for party events?
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
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"
How many Annual Meeting events happened in the United Kingdom region?
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
party_people
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"
Count the number of Annual Meeting events that took place in the region of the United Kingdom.
[Schema (values) (types)]: | party_people | region : region_id (text) , region_name (number) , date (text) , label (text) , format (text) , catalogue (text) | party : party_id (text) , minister (number) , took_office (text) , left_office (text) , region_id (text) , party_name (text) | member : member_id (text) , member_name (number) , party_id (text) , in_office (text) | party_events : event_id (text) , event_name (number) , party_id (text) , member_in_charge_id (text);
[Primary Keys]: region : region_id, party : party_id, member : member_id, party_events : event_id
[Foreign Keys]: party : region_id = region : region_id | member : party_id = party : party_id | party_events : member_in_charge_id = member : member_id | party_events : party_id = party : party_id
pilot_record
SELECT count(*) FROM pilot
How many pilots are there?
[Schema (values) (types)]: | pilot_record | aircraft : aircraft_id (text) , order_year (number) , manufacturer (number) , model (text) , fleet_series (text) , powertrain (text) , fuel_propulsion (text) | pilot : pilot_id (text) , pilot_name (number) , rank (number) , age (text) , nationality (text) , position (text) , join_year (text) , team (text) | pilot_record : record_id (text) , pilot_id (number) , aircraft_id (number) , date (text);
[Primary Keys]: aircraft : aircraft_id, pilot : pilot_id, pilot_record : pilot_id
[Foreign Keys]: pilot_record : aircraft_id = aircraft : aircraft_id | pilot_record : pilot_id = pilot : pilot_id
pilot_record
SELECT Pilot_name FROM pilot ORDER BY Rank ASC
List the names of pilots in ascending order of rank.
[Schema (values) (types)]: | pilot_record | aircraft : aircraft_id (text) , order_year (number) , manufacturer (number) , model (text) , fleet_series (text) , powertrain (text) , fuel_propulsion (text) | pilot : pilot_id (text) , pilot_name (number) , rank (number) , age (text) , nationality (text) , position (text) , join_year (text) , team (text) | pilot_record : record_id (text) , pilot_id (number) , aircraft_id (number) , date (text);
[Primary Keys]: aircraft : aircraft_id, pilot : pilot_id, pilot_record : pilot_id
[Foreign Keys]: pilot_record : aircraft_id = aircraft : aircraft_id | pilot_record : pilot_id = pilot : pilot_id
pilot_record
SELECT POSITION , Team FROM pilot
What are the positions and teams of pilots?
[Schema (values) (types)]: | pilot_record | aircraft : aircraft_id (text) , order_year (number) , manufacturer (number) , model (text) , fleet_series (text) , powertrain (text) , fuel_propulsion (text) | pilot : pilot_id (text) , pilot_name (number) , rank (number) , age (text) , nationality (text) , position (text) , join_year (text) , team (text) | pilot_record : record_id (text) , pilot_id (number) , aircraft_id (number) , date (text);
[Primary Keys]: aircraft : aircraft_id, pilot : pilot_id, pilot_record : pilot_id
[Foreign Keys]: pilot_record : aircraft_id = aircraft : aircraft_id | pilot_record : pilot_id = pilot : pilot_id
pilot_record
SELECT DISTINCT POSITION FROM pilot WHERE Age > 30
List the distinct positions of pilots older than 30.
[Schema (values) (types)]: | pilot_record | aircraft : aircraft_id (text) , order_year (number) , manufacturer (number) , model (text) , fleet_series (text) , powertrain (text) , fuel_propulsion (text) | pilot : pilot_id (text) , pilot_name (number) , rank (number) , age (text) , nationality (text) , position (text) , join_year (text) , team (text) | pilot_record : record_id (text) , pilot_id (number) , aircraft_id (number) , date (text);
[Primary Keys]: aircraft : aircraft_id, pilot : pilot_id, pilot_record : pilot_id
[Foreign Keys]: pilot_record : aircraft_id = aircraft : aircraft_id | pilot_record : pilot_id = pilot : pilot_id
pilot_record
SELECT Pilot_name FROM pilot WHERE Team = "Bradley" OR Team = "Fordham"
Show the names of pilots from team "Bradley" or "Fordham".
[Schema (values) (types)]: | pilot_record | aircraft : aircraft_id (text) , order_year (number) , manufacturer (number) , model (text) , fleet_series (text) , powertrain (text) , fuel_propulsion (text) | pilot : pilot_id (text) , pilot_name (number) , rank (number) , age (text) , nationality (text) , position (text) , join_year (text) , team (text) | pilot_record : record_id (text) , pilot_id (number) , aircraft_id (number) , date (text);
[Primary Keys]: aircraft : aircraft_id, pilot : pilot_id, pilot_record : pilot_id
[Foreign Keys]: pilot_record : aircraft_id = aircraft : aircraft_id | pilot_record : pilot_id = pilot : pilot_id
pilot_record
SELECT Join_Year FROM pilot ORDER BY Rank ASC LIMIT 1
What is the joined year of the pilot of the highest rank?
[Schema (values) (types)]: | pilot_record | aircraft : aircraft_id (text) , order_year (number) , manufacturer (number) , model (text) , fleet_series (text) , powertrain (text) , fuel_propulsion (text) | pilot : pilot_id (text) , pilot_name (number) , rank (number) , age (text) , nationality (text) , position (text) , join_year (text) , team (text) | pilot_record : record_id (text) , pilot_id (number) , aircraft_id (number) , date (text);
[Primary Keys]: aircraft : aircraft_id, pilot : pilot_id, pilot_record : pilot_id
[Foreign Keys]: pilot_record : aircraft_id = aircraft : aircraft_id | pilot_record : pilot_id = pilot : pilot_id
pilot_record
SELECT Nationality , COUNT(*) FROM pilot GROUP BY Nationality
What are the different nationalities of pilots? Show each nationality and the number of pilots of each nationality.
[Schema (values) (types)]: | pilot_record | aircraft : aircraft_id (text) , order_year (number) , manufacturer (number) , model (text) , fleet_series (text) , powertrain (text) , fuel_propulsion (text) | pilot : pilot_id (text) , pilot_name (number) , rank (number) , age (text) , nationality (text) , position (text) , join_year (text) , team (text) | pilot_record : record_id (text) , pilot_id (number) , aircraft_id (number) , date (text);
[Primary Keys]: aircraft : aircraft_id, pilot : pilot_id, pilot_record : pilot_id
[Foreign Keys]: pilot_record : aircraft_id = aircraft : aircraft_id | pilot_record : pilot_id = pilot : pilot_id
pilot_record
SELECT Nationality FROM pilot GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1
Show the most common nationality of pilots.
[Schema (values) (types)]: | pilot_record | aircraft : aircraft_id (text) , order_year (number) , manufacturer (number) , model (text) , fleet_series (text) , powertrain (text) , fuel_propulsion (text) | pilot : pilot_id (text) , pilot_name (number) , rank (number) , age (text) , nationality (text) , position (text) , join_year (text) , team (text) | pilot_record : record_id (text) , pilot_id (number) , aircraft_id (number) , date (text);
[Primary Keys]: aircraft : aircraft_id, pilot : pilot_id, pilot_record : pilot_id
[Foreign Keys]: pilot_record : aircraft_id = aircraft : aircraft_id | pilot_record : pilot_id = pilot : pilot_id
pilot_record
SELECT POSITION FROM pilot WHERE Join_Year < 2000 INTERSECT SELECT POSITION FROM pilot WHERE Join_Year > 2005
Show the pilot positions that have both pilots joining after year 2005 and pilots joining before 2000.
[Schema (values) (types)]: | pilot_record | aircraft : aircraft_id (text) , order_year (number) , manufacturer (number) , model (text) , fleet_series (text) , powertrain (text) , fuel_propulsion (text) | pilot : pilot_id (text) , pilot_name (number) , rank (number) , age (text) , nationality (text) , position (text) , join_year (text) , team (text) | pilot_record : record_id (text) , pilot_id (number) , aircraft_id (number) , date (text);
[Primary Keys]: aircraft : aircraft_id, pilot : pilot_id, pilot_record : pilot_id
[Foreign Keys]: pilot_record : aircraft_id = aircraft : aircraft_id | pilot_record : pilot_id = pilot : pilot_id
pilot_record
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
Show the names of pilots and models of aircrafts they have flied with.
[Schema (values) (types)]: | pilot_record | aircraft : aircraft_id (text) , order_year (number) , manufacturer (number) , model (text) , fleet_series (text) , powertrain (text) , fuel_propulsion (text) | pilot : pilot_id (text) , pilot_name (number) , rank (number) , age (text) , nationality (text) , position (text) , join_year (text) , team (text) | pilot_record : record_id (text) , pilot_id (number) , aircraft_id (number) , date (text);
[Primary Keys]: aircraft : aircraft_id, pilot : pilot_id, pilot_record : pilot_id
[Foreign Keys]: pilot_record : aircraft_id = aircraft : aircraft_id | pilot_record : pilot_id = pilot : pilot_id
pilot_record
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
Show the names of pilots and fleet series of the aircrafts they have flied with in ascending order of the rank of the pilot.
[Schema (values) (types)]: | pilot_record | aircraft : aircraft_id (text) , order_year (number) , manufacturer (number) , model (text) , fleet_series (text) , powertrain (text) , fuel_propulsion (text) | pilot : pilot_id (text) , pilot_name (number) , rank (number) , age (text) , nationality (text) , position (text) , join_year (text) , team (text) | pilot_record : record_id (text) , pilot_id (number) , aircraft_id (number) , date (text);
[Primary Keys]: aircraft : aircraft_id, pilot : pilot_id, pilot_record : pilot_id
[Foreign Keys]: pilot_record : aircraft_id = aircraft : aircraft_id | pilot_record : pilot_id = pilot : pilot_id
pilot_record
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
Show the fleet series of the aircrafts flied by pilots younger than 34
[Schema (values) (types)]: | pilot_record | aircraft : aircraft_id (text) , order_year (number) , manufacturer (number) , model (text) , fleet_series (text) , powertrain (text) , fuel_propulsion (text) | pilot : pilot_id (text) , pilot_name (number) , rank (number) , age (text) , nationality (text) , position (text) , join_year (text) , team (text) | pilot_record : record_id (text) , pilot_id (number) , aircraft_id (number) , date (text);
[Primary Keys]: aircraft : aircraft_id, pilot : pilot_id, pilot_record : pilot_id
[Foreign Keys]: pilot_record : aircraft_id = aircraft : aircraft_id | pilot_record : pilot_id = pilot : pilot_id
pilot_record
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
Show the names of pilots and the number of records they have.
[Schema (values) (types)]: | pilot_record | aircraft : aircraft_id (text) , order_year (number) , manufacturer (number) , model (text) , fleet_series (text) , powertrain (text) , fuel_propulsion (text) | pilot : pilot_id (text) , pilot_name (number) , rank (number) , age (text) , nationality (text) , position (text) , join_year (text) , team (text) | pilot_record : record_id (text) , pilot_id (number) , aircraft_id (number) , date (text);
[Primary Keys]: aircraft : aircraft_id, pilot : pilot_id, pilot_record : pilot_id
[Foreign Keys]: pilot_record : aircraft_id = aircraft : aircraft_id | pilot_record : pilot_id = pilot : pilot_id
pilot_record
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
Show names of pilots that have more than one record.
[Schema (values) (types)]: | pilot_record | aircraft : aircraft_id (text) , order_year (number) , manufacturer (number) , model (text) , fleet_series (text) , powertrain (text) , fuel_propulsion (text) | pilot : pilot_id (text) , pilot_name (number) , rank (number) , age (text) , nationality (text) , position (text) , join_year (text) , team (text) | pilot_record : record_id (text) , pilot_id (number) , aircraft_id (number) , date (text);
[Primary Keys]: aircraft : aircraft_id, pilot : pilot_id, pilot_record : pilot_id
[Foreign Keys]: pilot_record : aircraft_id = aircraft : aircraft_id | pilot_record : pilot_id = pilot : pilot_id
pilot_record
SELECT Pilot_name FROM pilot WHERE Pilot_ID NOT IN (SELECT Pilot_ID FROM pilot_record)
List the names of pilots that do not have any record.
[Schema (values) (types)]: | pilot_record | aircraft : aircraft_id (text) , order_year (number) , manufacturer (number) , model (text) , fleet_series (text) , powertrain (text) , fuel_propulsion (text) | pilot : pilot_id (text) , pilot_name (number) , rank (number) , age (text) , nationality (text) , position (text) , join_year (text) , team (text) | pilot_record : record_id (text) , pilot_id (number) , aircraft_id (number) , date (text);
[Primary Keys]: aircraft : aircraft_id, pilot : pilot_id, pilot_record : pilot_id
[Foreign Keys]: pilot_record : aircraft_id = aircraft : aircraft_id | pilot_record : pilot_id = pilot : pilot_id
cre_Doc_Control_Systems
SELECT document_status_code FROM Ref_Document_Status;
What document status codes do we have?
[Schema (values) (types)]: | cre_Doc_Control_Systems | Ref_Document_Types : document_type_code (text) , document_type_description (text) | Roles : role_code (text) , role_description (text) | Addresses : address_id (text) , address_details (text) | Ref_Document_Status : document_status_code (text) , document_status_description (text) | Ref_Shipping_Agents : shipping_agent_code (text) , shipping_agent_name (text) , shipping_agent_description (text) | Documents : document_id (text) , document_status_code (text) , document_type_code (text) , shipping_agent_code (text) , receipt_date (text) , receipt_number (number) , other_details (text) | Employees : employee_id (text) , role_code (text) , employee_name (text) , other_details (text) | Document_Drafts : document_id (text) , draft_number (text) , draft_details (text) | Draft_Copies : document_id (text) , draft_number (text) , copy_number (text) | Circulation_History : document_id (text) , draft_number (text) , copy_number (text) , employee_id (text) | Documents_Mailed : document_id (text) , mailed_to_address_id (text) , mailing_date (text);
[Primary Keys]: ref_document_types : document_type_code, roles : role_code, addresses : address_id, ref_document_status : document_status_code, ref_shipping_agents : shipping_agent_code, documents : document_id, employees : employee_id, document_drafts : document_id, draft_copies : document_id, circulation_history : document_id, documents_mailed : document_id
[Foreign Keys]: documents : shipping_agent_code = ref_shipping_agents : shipping_agent_code | documents : document_status_code = ref_document_status : document_status_code | documents : document_type_code = ref_document_types : document_type_code | employees : role_code = roles : role_code | document_drafts : document_id = documents : document_id | draft_copies : document_id = document_drafts : document_id | draft_copies : draft_number = document_drafts : draft_number | circulation_history : employee_id = employees : employee_id | circulation_history : document_id = draft_copies : document_id | circulation_history : draft_number = draft_copies : draft_number | circulation_history : copy_number = draft_copies : copy_number | documents_mailed : mailed_to_address_id = addresses : address_id | documents_mailed : document_id = documents : document_id
cre_Doc_Control_Systems
SELECT document_status_description FROM Ref_Document_Status WHERE document_status_code = "working";
What is the description of document status code 'working'?
[Schema (values) (types)]: | cre_Doc_Control_Systems | Ref_Document_Types : document_type_code (text) , document_type_description (text) | Roles : role_code (text) , role_description (text) | Addresses : address_id (text) , address_details (text) | Ref_Document_Status : document_status_code (text) , document_status_description (text) | Ref_Shipping_Agents : shipping_agent_code (text) , shipping_agent_name (text) , shipping_agent_description (text) | Documents : document_id (text) , document_status_code (text) , document_type_code (text) , shipping_agent_code (text) , receipt_date (text) , receipt_number (number) , other_details (text) | Employees : employee_id (text) , role_code (text) , employee_name (text) , other_details (text) | Document_Drafts : document_id (text) , draft_number (text) , draft_details (text) | Draft_Copies : document_id (text) , draft_number (text) , copy_number (text) | Circulation_History : document_id (text) , draft_number (text) , copy_number (text) , employee_id (text) | Documents_Mailed : document_id (text) , mailed_to_address_id (text) , mailing_date (text);
[Primary Keys]: ref_document_types : document_type_code, roles : role_code, addresses : address_id, ref_document_status : document_status_code, ref_shipping_agents : shipping_agent_code, documents : document_id, employees : employee_id, document_drafts : document_id, draft_copies : document_id, circulation_history : document_id, documents_mailed : document_id
[Foreign Keys]: documents : shipping_agent_code = ref_shipping_agents : shipping_agent_code | documents : document_status_code = ref_document_status : document_status_code | documents : document_type_code = ref_document_types : document_type_code | employees : role_code = roles : role_code | document_drafts : document_id = documents : document_id | draft_copies : document_id = document_drafts : document_id | draft_copies : draft_number = document_drafts : draft_number | circulation_history : employee_id = employees : employee_id | circulation_history : document_id = draft_copies : document_id | circulation_history : draft_number = draft_copies : draft_number | circulation_history : copy_number = draft_copies : copy_number | documents_mailed : mailed_to_address_id = addresses : address_id | documents_mailed : document_id = documents : document_id