Chinastark/bird_dataset huggingface dataset:
Database: mondial_geo
Question: Which country has the least organization membership?
SQL: SELECT country FROM organization WHERE country IN ( SELECT code FROM country ) GROUP BY country ORDER BY count(name) LIMIT 1
Database: mondial_geo
Question: List all countries with 'Category III' membership in 'IFAD' organization. Please also provide the capital of the country.
SQL: SELECT name, capital FROM country WHERE code IN ( SELECT country FROM ismember WHERE TYPE = 'Category III' AND organization = 'IFAD' )
Database: mondial_geo
Question: Name the organizations with the most members.
SQL: SELECT organization.name FROM organization INNER JOIN ismember ON ismember.country = organization.country INNER JOIN country ON ismember.country = country.code GROUP BY organization.name ORDER BY count(country.name) DESC LIMIT 1
Database: mondial_geo
Question: What is the capital of Australia? Is the capital a headquarter to any organization? Name the organization(s).
SQL: SELECT country.capital, organization.name FROM organization INNER JOIN country ON organization.city = country.capital WHERE country.name = 'Australia'
Database: mondial_geo
Note: percentage can be computed by [count(city = 'Washington') / count(all cities)] * 100%;
Question: Among the organizations where headquarters are in the 'USA', what is the percentage of the them are in 'Washington'?
SQL: SELECT cast(sum(CASE WHEN organization.city = 'Washington' THEN 1 ELSE 0 END) AS REAL) * 100 / count(organization.city) FROM country INNER JOIN organization ON country.code = organization.country WHERE organization.country = 'USA'
Database: mondial_geo
Question: What is the border length between 'USA' and 'MEX'
SQL: SELECT LENGTH FROM borders WHERE country1 = 'MEX' AND country2 = 'USA'
Database: mondial_geo
Question: What is the newest established organization where Singapore is a member of?
SQL: SELECT organization.name FROM country INNER JOIN ismember ON country.code = ismember.country INNER JOIN organization ON organization.country = ismember.country WHERE country.name = 'Singapore' ORDER BY organization.established DESC LIMIT 1
Database: mondial_geo
Question: Provide the population of the city of the 'World Tourism Organization' headquarter.
SQL: SELECT city.population FROM organization INNER JOIN city ON organization.city = city.name WHERE organization.name = 'World Tourism Organization'
Database: mondial_geo
Question: What is the height of mountain Dhaulagiri located and in which province is it located?
SQL: SELECT mountain.height, geo_mountain.province FROM mountain INNER JOIN geo_mountain ON mountain.name = geo_mountain.mountain WHERE mountain.name = 'Dhaulagiri'
Database: mondial_geo
Note: Alaska is a province;
Question: List all the name and height of all mountains in Alaska
SQL: SELECT mountain.name, mountain.height FROM mountain INNER JOIN geo_mountain ON mountain.name = geo_mountain.mountain WHERE geo_mountain.province = 'Alaska'
Database: mondial_geo
Question: What is the population of the country with the highest infant mortality rate?
SQL: SELECT country.population FROM country INNER JOIN population ON country.code = population.country ORDER BY population.infant_mortality DESC LIMIT 1
Database: mondial_geo
Question: State the inflation rate of Greece.
SQL: SELECT economy.inflation FROM country INNER JOIN economy ON country.code = economy.country WHERE country.name = 'Greece'
Database: mondial_geo
Question: Find the government type for the country with the highest percentage GDP in Agriculture.
SQL: SELECT politics.government FROM country INNER JOIN economy ON country.code = economy.country INNER JOIN politics ON politics.country = economy.country ORDER BY economy.agriculture DESC LIMIT 1
Database: mondial_geo
Note: Parliamentary democracy is a government form;
Question: List the full name its capital of all the countries with parliamentary democracy government.
SQL: SELECT country.capital FROM country INNER JOIN politics ON country.code = politics.country WHERE politics.government = 'parliamentary democracy'
Database: mondial_geo
Question: Provide a full list of countries and its population with more than 70% of Chinese.
SQL: SELECT country.name, country.population * ethnicgroup.percentage FROM country INNER JOIN ethnicgroup ON country.code = ethnicgroup.country WHERE ethnicgroup.name = 'Chinese' AND ethnicgroup.percentage > 70
Database: mondial_geo
Question: In which city has the greatest population, what is its percentage to its country population?
SQL: SELECT city.name, cast(city.population AS REAL) * 100 / country.population FROM country INNER JOIN province ON country.code = province.country INNER JOIN city ON city.country = province.country ORDER BY city.population DESC LIMIT 1
Database: mondial_geo
Question: When did the United States of America attained it's Independence?
SQL: SELECT politics.independence FROM politics INNER JOIN country ON politics.country = country.code WHERE country.name = 'United States'
Database: mondial_geo
Note: peak means the highest;
Question: What is the peak height of the highest volcanic type of mountain? Give it's name.
SQL: SELECT height, name FROM mountain WHERE TYPE = 'volcanic' ORDER BY height DESC LIMIT 1
Database: mondial_geo
Note: Saudi Arabia is a country;
Question: What is the name of the most recently founded organization in Saudi Arabia?
SQL: SELECT organization.name FROM organization INNER JOIN country ON organization.country = country.code WHERE country.name = 'Saudi Arabia' ORDER BY organization.established DESC LIMIT 1
Database: mondial_geo
Question: Which country has the 5th highest infant mortality rate?
SQL: SELECT country.name FROM population INNER JOIN country ON population.country = country.code ORDER BY population.infant_mortality DESC LIMIT 4, 1
Database: mondial_geo
Question: Which country has the widest range of religious practices?
SQL: SELECT country.name FROM country INNER JOIN religion ON country.code = religion.country GROUP BY country.name ORDER BY count(DISTINCT religion.name) DESC LIMIT 1
Database: mondial_geo
Question: What river has the 17th-longest length overall? Specify it's length.
SQL: SELECT name, LENGTH FROM river ORDER BY LENGTH DESC LIMIT 16, 1
Database: mondial_geo
Question: When did the country whose capital is Nouakchott attained it's independence?
SQL: SELECT politics.independence FROM country INNER JOIN politics ON country.code = politics.country WHERE country.capital = 'Nouakchott'
Database: mondial_geo
Note: gdp refers to gross domestic product;
Question: What is the name of the country with the smallest population, and what is its gross domestic product?
SQL: SELECT country.name, economy.gdp FROM country INNER JOIN economy ON country.code = economy.country ORDER BY country.population ASC LIMIT 1
Database: mondial_geo
Question: Which Zaire region is home to the country's deepest lake's Name it and list its depth.
SQL: SELECT province.name, lake.name, lake.depth FROM lake INNER JOIN located ON lake.name = located.lake INNER JOIN province ON province.name = located.province INNER JOIN country ON country.code = province.country WHERE country.name = 'Zaire'
Database: mondial_geo
Note: The elevation of the summit refers to height;
Question: What is the maximal elevation of the summit of the shortest mountain that can be found in the island of Madagaskar? Indicate what type of mountain it is.
SQL: SELECT mountain.height, mountain.type FROM island INNER JOIN mountainonisland ON island.name = mountainonisland.island INNER JOIN mountain ON mountain.name = mountainonisland.mountain WHERE island.name = 'Madagaskar' ORDER BY mountain.height DESC LIMIT 1
Database: mondial_geo
Note: gdp refers to gross domestic product; Nation and country are synonyms;
Question: Which nation, with a population ranging from 60,000,000 to 99,000,000, has the greatest gross domestic product?
SQL: SELECT country.name, economy.gdp FROM country INNER JOIN economy ON country.code = economy.country WHERE country.population BETWEEN 60000000 AND 90000000 ORDER BY economy.gdp DESC LIMIT 1
Database: mondial_geo
Note: Gross domestic product = gdp; Largest share of gdp in agricultural sector was mentioned in economy.agriculture;
Question: Which Asian country gave its agricultural sector the largest share of its gross domestic product?
SQL: SELECT encompasses.country FROM continent INNER JOIN encompasses ON continent.name = encompasses.continent INNER JOIN country ON encompasses.country = country.code INNER JOIN economy ON economy.country = country.code WHERE continent.name = 'Asia' ORDER BY economy.agriculture DESC LIMIT 1
Database: mondial_geo
Note: Nation and country are synonyms; Form of governance was mentioned in politics.government; Least prosperous means lowest gdp;
Question: What form of governance does the least prosperous nation in the world have?
SQL: SELECT politics.government FROM country INNER JOIN economy ON country.code = economy.country INNER JOIN politics ON politics.country = economy.country WHERE economy.gdp IS NOT NULL ORDER BY economy.gdp ASC LIMIT 1
Database: mondial_geo
Question: What year saw the greatest number of organizations created on the European continent?
SQL: SELECT strftime('%Y', organization.established) FROM continent INNER JOIN encompasses ON continent.name = encompasses.continent INNER JOIN country ON encompasses.country = country.code INNER JOIN organization ON organization.country = country.code WHERE continent.name = 'Europe' GROUP BY strftime('%Y', organization.established) ORDER BY count(organization.name) DESC LIMIT 1
Database: mondial_geo
Note: Nation and country are synonyms;
Question: What other country does the most populated nation in the world share a border with and how long is the border between the two nations?
SQL: SELECT borders.country2, borders.length FROM country INNER JOIN borders ON country.code = borders.country1 INNER JOIN country ON country.code = borders.country2 WHERE country.name = ( SELECT name FROM country ORDER BY population DESC LIMIT 1 )
Database: mondial_geo
Note: ation and country are synonyms; Gross domestic product = gdp; Portion of gdp devoted to industries appears in economy.industry; population Density = population / area;
Question: What is the population density of the nation whose capital city is in the Distrito Federal province, and what portion of its gross domestic product is devoted to its industries?
SQL: SELECT country.population / country.area, economy.industry FROM country INNER JOIN economy ON country.code = economy.country WHERE country.province = 'Distrito Federal'
Database: mondial_geo
Note: Inhabitants, synonymous with population;
Question: Lists all governments with a parliamentary democracy that achieved their independence between 01/01/1950 and 12/31/1999.
SQL: SELECT * FROM politics WHERE strftime('%Y', independence) BETWEEN '1950' AND '1999' AND government = 'parliamentary democracy'
Database: mondial_geo
Note: percentage = count(countries independent 1960) / total num of countries;
Question: What percentage of countries became independent during the year 1960?
SQL: SELECT cast(sum(CASE WHEN strftime('%Y', independence) = '1960' THEN 1 ELSE 0 END) AS REAL) * 100 / count(country) FROM politics
Database: mondial_geo
Question: List all deserts that are not between latitudes 30 and 40.
SQL: SELECT name FROM desert WHERE latitude < 30 OR latitude > 40
Database: mondial_geo
Note: coordinates consists of latitude, longitude;
Question: Indicate the coordinates of all the deserts whose area is in more than one country.
SQL: SELECT desert.latitude, desert.longitude FROM desert INNER JOIN geo_desert ON desert.name = geo_desert.desert GROUP BY desert.name, desert.latitude, desert.longitude HAVING count(desert.name) > 1
Database: mondial_geo
Note: Average population per area = population / area;
Question: What is the provincial capital of the province with a population of less than 80,000 that has the highest average population per area?
SQL: SELECT capprov FROM province WHERE population < 80000 ORDER BY population / area DESC LIMIT 1
Database: software_company
Note: marital_status = 'Never-married';
Question: How many customers have never married?
SQL: SELECT count(id) FROM customers WHERE marital_status = 'Never-married'
Database: software_company
Note: teenager is a person aged between 13 and 19 years;
Question: Among all the customers, how many of them are teenagers?
SQL: SELECT count(id) FROM customers WHERE age >= 13 AND age <= 19
Database: software_company
Note: education level of 11 refers to educationnum = 11;
Question: Please list the occupations of the customers with an education level of 11.
SQL: SELECT DISTINCT occupation FROM customers WHERE educationnum = 11
Database: software_company
Note: response = 'true';
Question: Of the first 60,000 customers' responses to the incentive mailing sent by the marketing department, how many of them are considered a true response?
SQL: SELECT count(refid) custmoer_number FROM mailings1_2 WHERE response = 'true'
Database: software_company
Note: over 30 refers to age > 30; occupation = 'Machine-op-inspct';
Question: Among the customers over 30, how many of them are Machine-op-inspcts?
SQL: SELECT count(id) FROM customers WHERE occupation = 'Machine-op-inspct' AND age > 30
Database: software_company
Note: education level of 11 refers to educationnum = 11; sex = 'Female';
Question: How many female customers have an education level of over 11?
SQL: SELECT count(id) FROM customers WHERE educationnum > 11 AND sex = 'Female'
Database: software_company
Note: response = 'true'; sex = 'Female';
Question: Of the first 60,000 customers who sent a true response to the incentive mailing sent by the marketing department, how many of them are female?
SQL: SELECT count(customers.id) FROM customers INNER JOIN mailings1_2 ON customers.id = mailings1_2.refid WHERE customers.sex = 'Female' AND mailings1_2.response = 'true'
Database: software_company
Note: over 40 refers to age > 40; response = 'true';
Question: Please list the occupations of the customers over 40 and have sent a true response to the incentive mailing sent by the marketing department.
SQL: SELECT DISTINCT customers.occupation FROM customers INNER JOIN mailings1_2 ON customers.id = mailings1_2.refid WHERE customers.age > 40 AND mailings1_2.response = 'true'
Database: software_company
Note: sex = 'Male', over 30,000 inhabitants refer to NHABITANTS_K > 30; place refers to geoid;
Question: Among the male customers, how many of them come from a place with over 30,000 inhabitants?
SQL: SELECT count(customers.geoid) FROM customers INNER JOIN demog ON customers.geoid = demog.geoid WHERE customers.sex = 'Male' AND demog.inhabitants_k > 30
Database: software_company
Note: place with the highest average income per month refers to geoid where MAX(income_k);
Question: How many customers are from the place with the highest average income per month?
SQL: SELECT count(customers.id) FROM customers INNER JOIN demog ON customers.geoid = demog.geoid ORDER BY demog.income_k DESC LIMIT 1
Database: software_company
Note: place with more than 20,000 and less than 30,000 inhabitants refers to geoid where inhabitants_k BETWEEN 20 AND 30; occupation = 'Machine-op-inspct';
Question: Among the customers from a place with more than 20,000 and less than 30,000 inhabitants, how many of them are Machine-op-inspcts?
SQL: SELECT count(customers.geoid) FROM customers INNER JOIN demog ON customers.geoid = demog.geoid WHERE customers.occupation = 'Machine-op-inspct' AND demog.inhabitants_k > 20 AND demog.inhabitants_k < 30
Database: software_company
Note: place with more inhabitants refers to geoid where id = 0 OR id = 1 and MAX(NHABITANTS_K);
Question: Which customer come from a place with more inhabitants, customer no.0 or customer no.1?
SQL: SELECT customers.id FROM customers INNER JOIN demog ON customers.geoid = demog.geoid WHERE customers.id = 0 OR customers.id = 1 ORDER BY inhabitants_k DESC LIMIT 1
Database: software_company
Note: response = 'true'; place with more than 30,000 inhabitants refers to geoid where inhabitants_k > 30;
Question: Of the first 60,000 customers who sent a true response to the incentive mailing sent by the marketing department, how many of them are from a place with more than 30,000 inhabitants?
SQL: SELECT count(customers.id) FROM customers INNER JOIN mailings1_2 ON customers.id = mailings1_2.refid INNER JOIN demog ON customers.geoid = demog.geoid WHERE demog.inhabitants_k > 30 AND mailings1_2.response = 'true'
Database: software_company
Note: response = 'true'; sex = 'Male'; marital_status = 'Divorced';
Question: Of the first 60,000 customers who sent a true response to the incentive mailing sent by the marketing department, how many of them are divorced males?
SQL: SELECT count(customers.id) FROM customers INNER JOIN mailings1_2 ON customers.id = mailings1_2.refid WHERE customers.sex = 'Male' AND customers.marital_status = 'Divorced' AND mailings1_2.response = 'true'
Database: software_company
Note: place with the highest average income per month refers to geoid where MAX(income_k); response = 'true';
Question: How many of the first 60,000 customers from the place with the highest average income per month have sent a true response to the incentive mailing sent by the marketing department?
SQL: SELECT count(customers.id) FROM customers INNER JOIN mailings1_2 ON customers.id = mailings1_2.refid INNER JOIN demog ON customers.geoid = demog.geoid WHERE mailings1_2.response = 'true' ORDER BY demog.income_k DESC LIMIT 1
Database: software_company
Note: the most customers are from refers to geoid where MAX(COUNT(id)); number of inhabitants refers to inhabitants_k;
Question: What is the number of inhabitants of the place the most customers are from?
SQL: SELECT DISTINCT demog.inhabitants_k FROM customers INNER JOIN demog ON customers.geoid = demog.geoid ORDER BY demog.inhabitants_k DESC
Database: software_company
Note: place with 44114 inhabitants refers to geoid where inhabitants_k = 44.114; sex = 'Male';
Question: Among the customers who come from the place with 25746 inhabitants, how many of them are male?
SQL: SELECT count(customers.id) FROM customers INNER JOIN demog ON customers.geoid = demog.geoid WHERE demog.inhabitants_k = 25.746 AND customers.sex = 'Male'
Database: software_company
Note: response = 'true'; teenagers are people aged between 13 and 19 years;
Question: Of the first 60,000 customers who sent a true response to the incentive mailing sent by the marketing department, how many of them are teenagers?
SQL: SELECT count(customers.id) FROM customers INNER JOIN mailings1_2 ON customers.id = mailings1_2.refid WHERE customers.age >= 13 AND customers.age <= 19 AND mailings1_2.response = 'true'
Database: software_company
Note: place with the highest average income per month refers to geoid where MAX(income_k); average education level refers to AVG(educationnum);
Question: What is the average education level of customers from the place with the highest average income per month?
SQL: SELECT avg(customers.educationnum) FROM customers INNER JOIN demog ON customers.geoid = demog.geoid ORDER BY demog.income_k DESC LIMIT 1
Database: software_company
Note: response = 'true'; AVG(age);
Question: What is the average age of first 60,000 customers who sent a true response to the incentive mailing sent by the marketing department?
SQL: SELECT avg(customers.age) FROM customers INNER JOIN mailings1_2 ON customers.id = mailings1_2.refid WHERE mailings1_2.response = 'true'
Database: software_company
Note: sex = 'Male';
Question: How many of the customers are male?
SQL: SELECT count(id) FROM customers WHERE sex = 'Male'
Database: software_company
Note: geographic identifier refers to geoid; occupation = 'Handlers-cleaners';
Question: List down the customer's geographic identifier who are handlers or cleaners.
SQL: SELECT geoid FROM customers WHERE occupation = 'Handlers-cleaners'
Database: software_company
Note: age below 30 refers to age < 30;
Question: What is the total number of customers with an age below 30?
SQL: SELECT count(id) FROM customers WHERE age < 30
Database: software_company
Note: geographic identifier with an income that ranges from 2100 to 2500 refers to geoid where income_k BETWEEN 2100 AND 2500;
Question: List down the geographic identifier with an income that ranges from 2100 to 2500.
SQL: SELECT geoid FROM demog WHERE income_k >= 2100 AND income_k <= 2500
Database: software_company
Note: geographic identifier from 20 to 50 refers to geoid BETWEEN 20 AND 50; number of inhabitants below 20 refers to inhabitants_k < 20;
Question: In geographic identifier from 20 to 50, how many of them has a number of inhabitants below 20?
SQL: SELECT count(geoid) FROM demog WHERE inhabitants_k < 20 AND geoid >= 20 AND geoid <= 50
Database: software_company
Note: geographic identifier 239 refers to geoid = 239; number of inhabitants refers to inhabitants_k; income refers to income_k;
Question: What is the number of inhabitants and income of geographic identifier 239?
SQL: SELECT inhabitants_k FROM demog WHERE geoid = 239
Database: software_company
Note: customers ages from 20 to 35 refer to id where age BETWEEN 20 AND 35; income K of 2000 and below refers to income_k < 2000; level of education refers to educationnum;
Question: Give the level of education and occupation of customers ages from 20 to 35 with an income K of 2000 and below.
SQL: SELECT customers.educationnum, customers.occupation FROM customers INNER JOIN demog ON customers.geoid = demog.geoid WHERE demog.income_k < 2000 AND customers.age >= 20 AND customers.age <= 35
Database: software_company
Note: number of inhabitants refers to inhabitants_k; older than 50 years old refers to age < 50; marital_status = 'Divorced;
Question: List down the number of inhabitants of customers with a divorced marital status and older than 50 years old.
SQL: SELECT count(customers.id) FROM customers INNER JOIN demog ON customers.geoid = demog.geoid WHERE customers.marital_status = 'Divorced' AND customers.age < 50
Database: software_company
Note: the oldest customer refers to MAX(age); geographic identifier refers to geoid; income refers to income_k;
Question: What is the geographic identifier and income of the oldest customer?
SQL: SELECT customers.geoid, demog.income_k FROM customers INNER JOIN demog ON customers.geoid = demog.geoid ORDER BY customers.age DESC LIMIT 1
Database: software_company
Note: male customers with an level of education of 4 and below refer to sex = 'Male' where educationnum < 4;
Question: Among the male customers with an level of education of 4 and below, list their income K.
SQL: SELECT income_k FROM demog WHERE geoid IN ( SELECT geoid FROM customers WHERE educationnum < 4 AND sex = 'Male' )
Database: software_company
Note: male customers with an level of education of 4 to 6 refer to sex = 'Male' where educationnum BETWEEN 4 AND 6; income refers to income_k;
Question: List the occupation and income of male customers with an level of education of 4 to 6.
SQL: SELECT customers.occupation, demog.income_k FROM customers INNER JOIN demog ON customers.geoid = demog.geoid WHERE customers.educationnum >= 4 AND customers.educationnum <= 6 AND customers.sex = 'Male'
Database: software_company
Note: widowed male customers ages from 40 to 60 refer to sex = 'Male' where age BETWEEN 40 AND 60 and marital_status = 'Widowed'; income ranges from 3000 and above refers to income_k BETWEEN 2000 AND 3000;
Question: In widowed male customers ages from 40 to 60, how many of them has an income ranges from 3000 and above?
SQL: SELECT count(customers.id) FROM customers INNER JOIN demog ON customers.geoid = demog.geoid WHERE customers.age >= 40 AND customers.age <= 60 AND customers.marital_status = 'Widowed' AND customers.sex = 'Male' AND demog.income_k >= 2000 AND demog.income_k <= 3000
Database: software_company
Note: number of inhabitants ranges of 30 to 40 refers to inhabitants_k BETWEEN 30 AND 40;
Question: What is the occupation of customers within number of inhabitants ranges of 30 to 40?
SQL: SELECT DISTINCT customers.occupation FROM customers INNER JOIN demog ON customers.geoid = demog.geoid WHERE demog.inhabitants_k >= 30 AND demog.inhabitants_k <= 40