Chinastark/bird_dataset huggingface dataset:
Database: world
Note: head of the state refers to headofstate; most crowded city refers to MAX(population);
Question: Who is the head of the state where the most crowded city belongs?
SQL: SELECT country.headofstate FROM country INNER JOIN city ON country.code = city.countrycode ORDER BY city.population DESC LIMIT 1
Database: world
Note: officially use the English language refers to `language` = 'English' AND isofficial = 'T'; highest capital refers to MAX(capital);
Question: Among the countries that officially use the English language, what country has the highest capital?
SQL: SELECT country.code FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode WHERE countrylanguage.language = 'English' AND countrylanguage.isofficial = 'T' ORDER BY country.capital DESC LIMIT 1
Database: world
Question: List down the cities that belong to the country with a life expectancy of 66.4.
SQL: SELECT city.name FROM country INNER JOIN city ON country.code = city.countrycode WHERE country.lifeexpectancy = 66.4
Database: world
Note: head of the state refers to headofstate; lowest percentage use of English as their language refers to MIN(percentage WHERE `language` = 'English');
Question: Give the head of the state of the country with the lowest percentage use of English as their language.
SQL: SELECT country.headofstate FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode WHERE countrylanguage.language = 'English' ORDER BY countrylanguage.percentage LIMIT 1
Database: world
Question: What is the surface area of the country where Sutton Coldfield city belongs?
SQL: SELECT country.surfacearea FROM country INNER JOIN city ON country.code = city.countrycode WHERE city.name = 'Sutton Coldfield'
Database: world
Note: population below 8000 refers to population < 8000;
Question: List down the languages of the countries that have population below 8000.
SQL: SELECT countrylanguage.language FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode WHERE country.population < 8000
Database: world
Note: official languages refers to isofficial = 'T'; Belgium is a name of country;
Question: What are the official languages used in Belgium?
SQL: SELECT countrylanguage.language FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode WHERE country.name = 'Belgium' AND countrylanguage.isofficial = 'T'
Database: world
Question: Give the cities and district names that belong to the country with Hajastan as its local name.
SQL: SELECT city.name, city.district FROM country INNER JOIN city ON country.code = city.countrycode WHERE country.localname = 'Hajastan'
Database: world
Note: Cyprus is a name of country;
Question: How many languages are used in Cyprus?
SQL: SELECT sum(CASE WHEN country.name = 'Cyprus' THEN 1 ELSE 0 END) FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode
Database: world
Note: Belize is a name of country;
Question: Provide the language used by the people of Belize.
SQL: SELECT countrylanguage.language FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode WHERE country.name = 'Belize'
Database: world
Note: headed by Adolf Ogi refers to headofstate = 'Adolf Ogi';
Question: List down the districts belong to the country headed by Adolf Ogi.
SQL: SELECT city.district FROM country INNER JOIN city ON country.code = city.countrycode WHERE country.headofstate = 'Adolf Ogi'
Database: world
Note: head of the country refers to headofstate;
Question: Who is the head of the country where Santa Catarina district belongs?
SQL: SELECT country.headofstate FROM country INNER JOIN city ON country.code = city.countrycode WHERE city.district = 'Santa Catarina'
Database: world
Note: gnp greater than 1500 refers to gnp > 1500 ; percentage = MULTIPLY(DIVidE(SUM(code WHERE gnp > 1500 AND language = 'English'), COUNT(code WHERE gnp > 1500)) 1.0); English as its language refers to language = 'English';
Question: Among the countries that have GNP greater than 1500, what is the percentage of the countries have English as its language?
SQL: SELECT cast(sum(iif(countrylanguage.language = 'English', 1, 0)) AS REAL) * 100 / count(country.code) FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode WHERE country.gnp > 1500
Database: world
Note: English speaking refers to language = 'English' ; difference = SUBTRACT(COUNT(language = 'English' WHERE governmentform = 'Republic'), COUNT(language = 'English' WHERE governmentform = 'ConstitutionalMonarchy'));
Question: In English speaking countries, provide the difference between the number of countries with republic and constitutional monarchy as its government form.
SQL: SELECT count(country.governmentform = 'Republic') - count(country.governmentform = 'ConstitutionalMonarchy') FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode WHERE countrylanguage.language = 'English'
Database: world
Note: declared independence in 1994 refers to indepyear = 1994;
Question: What country declared its independence in 1994?
SQL: SELECT name FROM country WHERE indepyear = 1994
Database: world
Note: Asia refers to continent = 'Asia';
Question: List all the countries in Asia.
SQL: SELECT name FROM country WHERE continent = 'Asia'
Database: world
Note: Asia refers to continent = 'Asia'; largest gross national product refers to MAX(gnp);
Question: What country in Asia has the largest gross national product(GNP)?
SQL: SELECT name FROM country WHERE continent = 'Asia' ORDER BY gnp DESC LIMIT 1
Database: world
Note: Philippines refers to countrycode = 'PHL';
Question: How many cities are in the Philippines?
SQL: SELECT count(id) FROM city WHERE name = 'PHL'
Database: world
Note: Ukraine is a name of country;
Question: What is the local name of Ukraine that they are also known for?
SQL: SELECT localname FROM country WHERE name = 'Ukraine'
Database: world
Note: Socialistic Republic form of government refers to governmentform = 'Socialistic Republic';
Question: How many countries have Socialistic Republic form of government?
SQL: SELECT count(code) FROM country WHERE governmentform = 'Socialistic Republic'
Database: world
Note: official language refers to isofficial = 'T'; China is a name of country;
Question: What is the official language of China?
SQL: SELECT countrylanguage.language FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode WHERE country.name = 'China' AND countrylanguage.isofficial = 'T'
Database: world
Note: percent refers to percentage; China is a name of country; use Chinese as their language refers to language = 'Chinese';
Question: How many percent of the population of China used Chinese as their language?
SQL: SELECT countrylanguage.percentage FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode WHERE country.name = 'China' AND countrylanguage.language = 'Chinese'
Database: world
Note: form of government refers to governmentform;
Question: What is the form of government that the city of Manila has?
SQL: SELECT country.governmentform FROM country INNER JOIN city ON country.code = city.countrycode WHERE city.name = 'Manila'
Database: world
Note: capital city refers to capital; Philippines is a name of country;
Question: What is the capital city of the Philippines?
SQL: SELECT country.capital FROM country INNER JOIN city ON country.code = city.countrycode WHERE country.name = 'Philipiines'
Database: world
Note: Europe refers to continent = 'Europe';
Question: List all the languages used in Europe.
SQL: SELECT countrylanguage.language FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode WHERE country.continent = 'Europe'
Database: world
Question: Who is the head of state of the country where the city of Pyongyang is under?
SQL: SELECT country.headofstate FROM country INNER JOIN city ON country.code = city.countrycode WHERE city.name = 'Pyongyang'
Database: world
Note: unofficial languages refers to isofficial = 'F'; Italy is a name of country;
Question: How many unofficial languages are used in Italy?
SQL: SELECT sum(CASE WHEN countrylanguage.isofficial = 'F' THEN 1 ELSE 0 END) FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode WHERE country.name = 'Italy'
Database: world
Note: Russia is a name of country; least population refers to MIN(population);
Question: What city in Russia has the least population?
SQL: SELECT city.name FROM country INNER JOIN city ON country.code = city.countrycode WHERE country.name = 'Russian Federation' ORDER BY city.population ASC LIMIT 1
Database: world
Note: high life expectancy at birth refers to MAX(lifeexpectancy);
Question: List all the cities in the country where there is high life expectancy at birth.
SQL: SELECT city.name FROM country INNER JOIN city ON country.code = city.countrycode ORDER BY country.lifeexpectancy DESC LIMIT 1
Database: world
Note: official language refers to isofficial = 'T'; unofficial language refers to isofficial = 'F'; declared independence in 1830 refers to indepyear = 1830;
Question: List all the official and unofficial languages used by the country that declared its independence in 1830.
SQL: SELECT countrylanguage.language, countrylanguage.isofficial FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode WHERE country.indepyear = 1830 GROUP BY countrylanguage.language, countrylanguage.isofficial
Database: world
Note: capital city refers to capital; largest population refers to MAX(population);
Question: What is the capital city of the country with largest population?
SQL: SELECT country.capital FROM country INNER JOIN city ON country.code = city.countrycode ORDER BY country.population DESC LIMIT 1
Database: world
Note: use English as unofficial language refers to language = 'English' WHERE isofficial = 'F';
Question: List all the countries in the continent of Asia that use English as their unofficial language.
SQL: SELECT country.name FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode WHERE country.continent = 'Asia' AND countrylanguage.isofficial = 'F' GROUP BY country.name
Database: world
Note: average gnp = AVG(gnp); use Arabic language refers to language = 'Arabic';
Question: Calculate the average GNP of all countries that use Arabic language.
SQL: SELECT avg(country.gnp) FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode WHERE countrylanguage.language = 'Arabic'
Database: world
Note: percentage = DIVidE(MULTIPLY(SUM(surfacearea WHERE language = 'Chinese'), SUM(surfacearea)), 1.0); Chinese as one of the languages refers to language = 'Chinese';
Question: Calculate the percentage of the surface area of all countries that uses Chinese as one of their languages.
SQL: SELECT cast(sum(iif(countrylanguage.language = 'Chinese', country.surfacearea, 0)) AS REAL) * 100 / sum(country.surfacearea) FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode
Database: world
Note: smallest surface area refers to MIN(smallest surface area);
Question: Which country has the smallest surface area?
SQL: SELECT name FROM country ORDER BY surfacearea ASC LIMIT 1
Database: world
Note: largest population refers to MAX(population);
Question: Write down the name of the largest population country.
SQL: SELECT name FROM country ORDER BY population DESC LIMIT 1
Database: world
Note: smallest population refers to MIN(population);
Question: What is the language of the smallest population country?
SQL: SELECT countrylanguage.language FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode ORDER BY country.population ASC LIMIT 1
Database: world
Note: English is the official language refers to language = 'English' AND isofficial = 'T';
Question: List down the name of countries whereby English is their official language.
SQL: SELECT country.name FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode WHERE countrylanguage.language = 'English' AND countrylanguage.isofficial = 'T'
Database: world
Note: official lanaguage refers to isofficial = 'T'; declared independence after 1990 refers to indepyear > 1990;
Question: List down the official language of the countries which declared independence after 1990,
SQL: SELECT country.name, countrylanguage.language FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode WHERE country.indepyear > 1990 AND countrylanguage.isofficial = 'T'
Database: world
Note: English refers to language = 'English'; Australia is a name of country;
Question: What is the percentage of English used in Australia?
SQL: SELECT countrylanguage.percentage FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode WHERE country.name = 'Australia' AND countrylanguage.language = 'English'
Database: world
Note: Malaysia is a name of country;
Question: List down languages used in Malaysia.
SQL: SELECT countrylanguage.language FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode WHERE country.name = 'Malaysia'
Database: world
Note: most crowded city refers to MAX(population);
Question: Which country has the most crowded city in the world?
SQL: SELECT country.name FROM country INNER JOIN city ON country.code = city.countrycode ORDER BY city.population DESC LIMIT 1
Database: world
Note: most crowded city refers to MAX(population);
Question: What is the life expectancy of residents in the most crowded city?
SQL: SELECT country.lifeexpectancy FROM city INNER JOIN country ON city.countrycode = country.code ORDER BY city.population DESC LIMIT 1
Database: world
Note: least crowded city refers to MIN(population);
Question: What is the GNP of the least crowded city in the world?
SQL: SELECT country.gnp FROM city INNER JOIN country ON city.countrycode = country.code ORDER BY city.population ASC LIMIT 1
Database: world
Note: most crowded cities refers to MAX(population); has the most languages used refers to MAX(COUNT(language));
Question: Within the 5 most crowded cities in the world, which country has the most languages used?
SQL: SELECT name FROM ( SELECT city.name, countrylanguage.language FROM city INNER JOIN countrylanguage ON city.countrycode = countrylanguage.countrycode GROUP BY city.name, city.population, countrylanguage.language ORDER BY city.population DESC ) AS t3 GROUP BY t3.name ORDER BY count(LANGUAGE) DESC LIMIT 1
Database: world
Note: smallest surface area refers to MIN(smallest surface area); most crowded city refers to MAX(population);
Question: Which country has the smallest surface area and the most crowded city?
SQL: SELECT country.name FROM city INNER JOIN country ON city.countrycode = country.code ORDER BY city.population DESC, country.surfacearea DESC LIMIT 1
Database: world
Note: China is a name of country;
Question: List down all cities of China.
SQL: SELECT city.name FROM city INNER JOIN country ON city.countrycode = country.code WHERE country.name = 'China'
Database: world
Question: What are the cities for country called "Â´Uman" in local name.
SQL: SELECT city.name FROM city INNER JOIN country ON city.countrycode = country.code WHERE country.localname = 'Â´Uman'
Database: world
Note: average life expectancy = AVG(lifeexpectancy); speak Arabic refers to `language` = 'Arabic';
Question: What is the average life expentancy of countries that speak Arabic?
SQL: SELECT avg(country.lifeexpectancy) FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode WHERE countrylanguage.language = 'Arabic'
Database: world
Note: gnp growth rate = DIVidE(SUBTRACT(gnp, gnpold), gnpold); Shanghai is a name of city;
Question: What is the GNP growth rate by the country of Shanghai?
SQL: SELECT cast((country.gnp - country.gnpold) AS REAL) / country.gnpold FROM country INNER JOIN city ON country.code = city.countrycode WHERE city.name = 'Shanghai'
Database: world
Note: Zaanstad is a name of city;
Question: What is the district of Zaanstad?
SQL: SELECT district FROM city WHERE name = 'Zaanstad'
Database: world
Note: highest population refers to MAX(population);
Question: What city has the highest population?
SQL: SELECT name FROM city ORDER BY population DESC LIMIT 1
Database: world
Question: Provide the district of the city with a population of 201843.
SQL: SELECT district FROM city WHERE population = 201843
Database: world
Note: largest surface area refers to MAX(surfacearea);
Question: What country has the largest surface area?
SQL: SELECT name FROM country ORDER BY surfacearea DESC LIMIT 1
Database: world
Question: How many countries have a life expectancy of 75.1?
SQL: SELECT count(*) FROM country WHERE lifeexpectancy = 75.1
Database: world
Note: year of independence refers to indepyear; Brunei is a name of country;
Question: What is the year of independence of Brunei?
SQL: SELECT indepyear FROM country WHERE name = 'Brunei'
Database: world
Note: no gnp refers to gnp = 0;
Question: How many countries have no GNP?
SQL: SELECT count(*) FROM country WHERE gnp = 0
Database: world
Note: average surface area = AVG(surfacearea);
Question: What is the average surface area of all countries?
SQL: SELECT avg(surfacearea) FROM country
Database: world
Question: How many languages are there in the country where Tocantins district belongs?
SQL: SELECT count(DISTINCT countrylanguage.language) FROM city INNER JOIN countrylanguage ON city.countrycode = countrylanguage.countrycode WHERE city.district = 'Tocantins'
Database: world
Note: largest surface area refers to MAX(surfacearea);
Question: What are the districts that belong to the country with the largest surface area?
SQL: SELECT city.district FROM city INNER JOIN country ON city.countrycode = country.code WHERE country.name = ( SELECT name FROM country ORDER BY surfacearea DESC LIMIT 1 )
Database: world
Note: ruled by Kostis Stefanopoulos refers to headofstate = 'Kostis Stefanopoulos';
Question: How many cities are there in the country ruled by Kostis Stefanopoulos?
SQL: SELECT count(DISTINCT city.name) FROM city INNER JOIN country ON city.countrycode = country.code WHERE country.headofstate = 'Kostis Stefanopoulos'
Database: world
Note: official language refers to isofficial = 'T'; Greece is a name of country;
Question: What are the official languages used in Greece?
SQL: SELECT countrylanguage.language FROM countrylanguage INNER JOIN country ON countrylanguage.countrycode = country.code WHERE countrylanguage.isofficial = 'T' AND country.name = 'Greece'
Database: world
Question: Give the population of the country where Queimados city belongs.
SQL: SELECT country.population FROM city INNER JOIN country ON city.countrycode = country.code WHERE city.name = 'Queimados'
Database: world
Note: official language refers to isofficial = 'T'; least population refers to MIN(population);
Question: What are the official languages of the country where you can find the city with the least population?
SQL: SELECT countrylanguage.language FROM city INNER JOIN countrylanguage ON city.countrycode = countrylanguage.countrycode WHERE countrylanguage.isofficial = 'T' ORDER BY city.population ASC LIMIT 1
Database: world
Question: What is the surface area and GNP of the country where Namibe district belongs?
SQL: SELECT country.surfacearea, country.gnp FROM city INNER JOIN country ON city.countrycode = country.code WHERE city.district = 'Namibe'
Database: world
Note: officially uses English as their language refers to `language` = 'English' AND isofficial = 'T';
Question: List the names of the country that officially uses English as their language.
SQL: SELECT country.name FROM countrylanguage INNER JOIN country ON countrylanguage.countrycode = country.code WHERE countrylanguage.isofficial = 'T' AND countrylanguage.language = 'English'
Database: world
Note: lowest surface area refers to MIN(surfacearea);
Question: What are the districts that belong to the country with the lowest surface area?
SQL: SELECT city.district FROM city INNER JOIN country ON city.countrycode = country.code ORDER BY country.surfacearea ASC LIMIT 1
Database: world
Note: gnp lower than 1000 refers to gnp < 1000; Dutch as their language refers to `language` = 'Dutch';
Question: List down the country names of countries that have a GNP lower than 1000 and have Dutch as their language.
SQL: SELECT country.name FROM countrylanguage INNER JOIN country ON countrylanguage.countrycode = country.code WHERE country.gnp < 1000 AND countrylanguage.isofficial = 'T' AND countrylanguage.language = 'Dutch'
Database: world
Question: What is the GNP of the country where district "Entre Rios" belongs?
SQL: SELECT country.gnp FROM city INNER JOIN country ON city.countrycode = country.code WHERE city.district = 'Entre Rios' LIMIT 1
Database: world
Question: What is the local name of the country where "The Valley" city belongs?
SQL: SELECT country.localname FROM city INNER JOIN country ON city.countrycode = country.code WHERE city.name = 'The Valley'
Database: world
Note: surface area greater than 7000000 refers to surfacearea > 7000000;
Question: List down the cities belongs to the country that has surface area greater than 7000000.
SQL: SELECT country.name, city.name FROM city INNER JOIN country ON city.countrycode = country.code WHERE country.surfacearea > 7000000
Database: world
Note: uses Japanese as their language refers to `language` = 'Japanese';
Question: What is the life expectancy of the countries that uses Japanese as their language?
SQL: SELECT avg(country.lifeexpectancy) FROM countrylanguage INNER JOIN country ON countrylanguage.countrycode = country.code WHERE countrylanguage.language = 'Japanese'
Database: world
Question: How many cities are there in the country with the surface area of 652090?
SQL: SELECT country.name, count(city.name) FROM city INNER JOIN country ON city.countrycode = country.code WHERE country.surfacearea = 652090 GROUP BY country.name
Database: world
Note: independence year between 1980 to 1995 refers to indepyear BETWEEN 1980 AND 1995;
Question: List down the languages of countries with an independence year between 1980 to 1995.
SQL: SELECT country.name, countrylanguage.language FROM countrylanguage INNER JOIN country ON countrylanguage.countrycode = country.code WHERE country.indepyear BETWEEN 1980 AND 1995
Database: world
Question: What is the life expectancy of the people living in Calama city?
SQL: SELECT country.lifeexpectancy FROM city INNER JOIN country ON city.countrycode = country.code WHERE city.name = 'Calama'
Database: world
Note: ruled by Pierre Buyoya refers to headofstate = 'Pierre Buyoya';
Question: Provide the language used in the country ruled by Pierre Buyoya.
SQL: SELECT countrylanguage.language FROM countrylanguage INNER JOIN country ON countrylanguage.countrycode = country.code WHERE country.headofstate = 'Pierre Buyoya'
Database: world
Note: constitutional monarchy refers to governmentform = 'Constitutional Monarchy'; percentage = MULTIPLY(DIVidE(SUM(governmentform = 'Constitutional Monarchy' WHERE district = 'England'), COUNT(governmentform = 'Constitutional Monarchy')), 100);
Question: In countries with constitutional monarchy, what is the percentage of cities located in the district of England?
SQL: SELECT cast(sum(CASE WHEN city.district = 'England' THEN 1 ELSE 0 END) AS REAL) * 100 / count(*) FROM city INNER JOIN country ON city.countrycode = country.code WHERE country.governmentform = 'Constitutional Monarchy'
Database: world
Note: life expectancy greater than 80% life expectancy of all countries refers to lifeexpectancy < (MULTIPLY(AVG(lifeexpectancy), 0.8));
Question: Among the cities with a population between 140000 and 150000, list the country that has life expectancy greater than 80% life expectancy of all countries.
SQL: SELECT country.name FROM city INNER JOIN country ON city.countrycode = country.code WHERE city.population BETWEEN 140000 AND 150000 GROUP BY country.name, lifeexpectancy HAVING lifeexpectancy < ( SELECT avg(lifeexpectancy) FROM country ) * 0.8