db_id
stringclasses
68 values
question
stringlengths
24
325
evidence
stringlengths
0
580
SQL
stringlengths
23
728
hockey
Please list the names of the teams that had a tie in 1909.
tie refers to T>0; year = 1909;
SELECT T2.name, T3.name FROM TeamVsTeam AS T1 INNER JOIN Teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year INNER JOIN Teams AS T3 ON T1.year = T3.year AND T1.oppID = T3.tmID WHERE T1.year = 1909 AND T1.T = 1
hockey
Please list the first names of the coaches who have taught the Montreal Canadiens.
Montreal Canadiens is the name of team.
SELECT DISTINCT T3.firstName FROM Coaches AS T1 INNER JOIN Teams AS T2 ON T1.year = T2.year AND T1.tmID = T2.tmID INNER JOIN Master AS T3 ON T1.coachID = T3.coachID WHERE T2.name = 'Montreal Canadiens'
hockey
How many coaches of the Montreal Canadiens have gotten in the Hall of Fame?
have gotten in the Hall of Fame means hofID is not NULL; Montreal Canadiens is the name of team.
SELECT COUNT(DISTINCT hofID) FROM Coaches AS T1 INNER JOIN Teams AS T2 ON T1.year = T2.year AND T1.tmID = T2.tmID INNER JOIN Master AS T3 ON T1.coachID = T3.coachID WHERE T2.name = 'Montreal Canadiens'
hockey
Please list the first names of the coaches whose team played in 1922's Stanley Cup finals.
teams refer to tmID; year = 1922;
SELECT T3.firstName FROM Coaches AS T1 INNER JOIN TeamsSC AS T2 ON T1.year = T2.year AND T1.tmID = T2.tmID INNER JOIN Master AS T3 ON T1.coachID = T3.coachID WHERE T2.year = 1922
hockey
Among the coaches who are born in the USA, how many of them used to train the Philadelphia Flyers?
born in the USA refers to birthCountry = 'USA'; Philadelphia Flyers is the name of team;
SELECT COUNT(DISTINCT T3.coachID) FROM Coaches AS T1 INNER JOIN Teams AS T2 ON T1.year = T2.year AND T1.tmID = T2.tmID INNER JOIN Master AS T3 ON T1.coachID = T3.coachID WHERE T2.name = 'Philadelphia Flyers' AND T3.birthCountry = 'USA'
hockey
How many coaches who have taught the Buffalo Sabres have died?
have died means deathYear is not NULL; Buffalo Sabres is the name of team;
SELECT COUNT(DISTINCT T3.coachID) FROM Coaches AS T1 INNER JOIN Teams AS T2 ON T1.year = T2.year AND T1.tmID = T2.tmID INNER JOIN Master AS T3 ON T1.coachID = T3.coachID WHERE T2.name = 'Buffalo Sabres' AND T3.deathYear IS NOT NULL
hockey
Among the coaches who taught the teams in 1922's Stanley Cup finals, how many of them are from the USA?
from the USA refers to birthCountry = 'USA'; year = 1922;
SELECT COUNT(DISTINCT T3.coachID) FROM Coaches AS T1 INNER JOIN TeamsSC AS T2 ON T1.year = T2.year AND T1.tmID = T2.tmID INNER JOIN Master AS T3 ON T1.coachID = T3.coachID WHERE T2.year = 1922 AND T3.birthCountry = 'USA'
hockey
In the year 2000, which team has played the most games against the Buffalo Sabres?
which team played the most games against refers to oppID where MAX(SUM(G); Buffalo Sabres is the name of team;
SELECT T3.name FROM TeamVsTeam AS T1 INNER JOIN Teams AS T2 ON T1.year = T2.year AND T1.oppID = T2.tmID INNER JOIN Teams AS T3 ON T1.year = T3.year AND T1.tmID = T3.tmID WHERE T1.year = 2000 AND T2.name = 'Buffalo Sabres' GROUP BY T3.name ORDER BY SUM(T2.G) DESC LIMIT 1
hockey
Please list the names of all the teams that have played against the Buffalo Sabres.
teams that have played against refer to oppID; Buffalo Sabres is the name of team;
SELECT DISTINCT T3.name FROM TeamVsTeam AS T1 INNER JOIN Teams AS T2 ON T1.year = T2.year AND T1.oppID = T2.tmID INNER JOIN Teams AS T3 ON T1.year = T3.year AND T1.tmID = T3.tmID WHERE T2.name = 'Buffalo Sabres'
hockey
How many penalty minutes did the Montreal Canadiens have in the 1918's Stanley Cup Finals?
penalty minutes refer to PIM; year = 1918; Montreal Canadiens is name of team;
SELECT T2.PIM FROM Teams AS T1 INNER JOIN TeamsSC AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.name = 'Montreal Canadiens' AND T1.year = 1918
hockey
Which coach was the first one to teach the Montreal Canadiens, please give his first name.
the first one refers to MIN(year);
SELECT T3.firstName FROM Coaches AS T1 INNER JOIN Teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year INNER JOIN Master AS T3 ON T1.coachID = T3.coachID WHERE T2.name = 'Montreal Canadiens' ORDER BY T1.year LIMIT 1
hockey
What is the average winning rate of the Buffalo Sabres in 2000?
DIVIDE(SUM(DIVIDE(W,G), COUNT(oppID) where year = 2000; Montreal Canadiens is name of team;
SELECT SUM(CAST(T2.W AS REAL) / T2.G) / COUNT(T1.oppID) FROM TeamVsTeam AS T1 INNER JOIN Teams AS T2 ON T1.year = T2.year AND T1.tmID = T2.tmID WHERE T2.name = 'Buffalo Sabres' AND T1.year = 2000
hockey
What is the average winning rate of the Montreal Canadiens in the Stanley Cup finals?
DIVIDE(SUM(DIVIDE(W,G), COUNT(oppID);
SELECT SUM(T2.W / T2.G) / SUM(T2.G + T2.W) FROM Teams AS T1 INNER JOIN TeamsSC AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.name = 'Montreal Canadiens'
hockey
What is the percentage of American coaches among all the coaches who taught the Montreal Canadiens?
American refers to birthCountry = 'USA'; DIVIDE(COUNT(coachID where birthCountry = 'USA', name` = 'Montreal Canadiens'), COUNT(coachID where name` = 'Montreal Canadiens')) as percentage;
SELECT SUM(CAST(T2.W AS REAL) / T2.G) / SUM(T2.G + T2.W) FROM Teams AS T1 INNER JOIN TeamsSC AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.name = 'Montreal Canadiens'
hockey
Who was the latest non player/builder to become the hall of famer? Give the full name.
latest refers to MAX(year); non player/builder refers to category = NOT IN ('player', 'builder');
SELECT name FROM HOF WHERE category IN ('Player', 'Builder') ORDER BY year DESC LIMIT 1
hockey
For all the referees, who became a hall of famer in the 1970s? What's his hofID?
1970s refers to year between 1970 and 1979; referees stand for category;
SELECT name, hofID FROM HOF WHERE category = 'Builder' AND year BETWEEN 1970 AND 1979
hockey
In the year 1958, what is the total number of players that became hall of famers?
hall of famers refers to hofID; players stand for category;
SELECT COUNT(hofID) FROM HOF WHERE category = 'Player' AND year = 1958
hockey
How many hall of famers both played and coached in the league?
hall of famers refers to hofID; both played and coached means playerID is not NULL and coachID is not NULL;
SELECT COUNT(playerID) FROM Master WHERE hofID IS NOT NULL AND playerID IS NOT NULL AND coachID IS NOT NULL
hockey
What is the number of players whose last name is Green that played in the league but not coached?
played in the league but not coached means playerID is not NULL and coachID is NULL;
SELECT COUNT(playerID) FROM Master WHERE lastName = 'Green' AND coachID IS NULL
hockey
For the team that Scotty Bowman coached in 1982, how many bench minor penalties did they have that year?
bench minor penalties refer to BenchMinor; Scotty Bowman is a coach; year = 1982;
SELECT T2.BenchMinor FROM Coaches AS T1 INNER JOIN Teams AS T2 ON T1.year = T2.year AND T1.tmID = T2.tmID INNER JOIN Master AS T3 ON T1.coachID = T3.coachID WHERE T3.firstName = 'Scotty' AND T3.lastName = 'Bowman' AND T1.year = 1982
hockey
For the goalie whose last name is "Young", how many teams did he play in?
goalie is a players; teams refer to tmID;
SELECT COUNT(DISTINCT T1.tmID) FROM Goalies AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID WHERE T2.lastName = 'Young'
hockey
How many goalies played for Calgary Flames?
Calgary Flames is the name of team;
SELECT COUNT(DISTINCT playerID) FROM Goalies AS T1 INNER JOIN Teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T2.name = 'Calgary Flames'
hockey
How many Haileybury Hockey Club goalies became a hall of famer?
hall of famers refers to hofID where playerID is not NULL;
SELECT COUNT(DISTINCT T1.playerID) FROM Goalies AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID INNER JOIN Teams AS T3 ON T1.tmID = T3.tmID AND T1.year = T3.year WHERE T3.name = 'Haileybury Hockey Club' AND T2.hofID IS NOT NULL
hockey
State the player ID and coach ID of person who have become coach after retirement.
after retirement means playerID Iis not NULL and coachID is not NULL;
SELECT playerID, coachID FROM Master WHERE playerID IS NOT NULL AND coachID IS NOT NULL
hockey
Who is the heaviest player? State player ID of 5 heaviest players.
5 heaviest players refer to MAX(weight) limit to 5 playerID;
SELECT playerID FROM Master ORDER BY weight DESC LIMIT 5
hockey
What is the full name of players origin from Finland?
origin from Finland refers to birthCountry = 'Finland';
SELECT DISTINCT firstName, lastName FROM Master WHERE birthCountry = 'Finland'
hockey
List down player ID of players who have passed away.
passed away means deathYear is not NULL;
SELECT DISTINCT playerID FROM Master WHERE deathYear IS NOT NULL AND playerID IS NOT NULL
hockey
List down the first name of coaches who still coach after year 2000.
after year 2000 refers to year>2000;
SELECT DISTINCT T1.firstName FROM Master AS T1 INNER JOIN Coaches AS T2 ON T1.coachID = T2.coachID WHERE T2.year > 2000
hockey
What is the height and weight for coaches who have won awards in 1930?
year = 1930;
SELECT T1.height, T1.weight FROM Master AS T1 INNER JOIN AwardsCoaches AS T2 ON T1.coachID = T2.coachID WHERE T2.year = '1930'
hockey
Is there any coach who has not been a player before but has won award? State the ID.
coach who has not been a player means playerID is NULL and coachID is not NULL;
SELECT DISTINCT T2.coachID FROM Master AS T1 INNER JOIN AwardsCoaches AS T2 ON T1.coachID = T2.coachID WHERE T1.playerID IS NULL
hockey
What is the total number of game played for players from USA?
game played refers to GP; from USA refers to birthCountry = 'USA';
SELECT COUNT(T2.GP) FROM Master AS T1 INNER JOIN Scoring AS T2 ON T1.playerID = T2.playerID WHERE T1.birthCountry = 'USA'
hockey
Calculate the total points scored by team ID ANA and list down the coashes of the team.
points scored refers to Pts; team ID refers to tmID;
SELECT SUM(T2.Pts), T1.coachID FROM Coaches AS T1 INNER JOIN Teams AS T2 ON T2.tmID = T1.tmID WHERE T2.tmID = 'ANA' GROUP BY T1.coachID
hockey
In 1976, how many goals achieved by team 'BIR' in Division 'EW'?
year = 1976; BIR refers to tmID; Division 'EW' refers to divID = 'EW'; goals = G;
SELECT SUM(T2.G) FROM Teams AS T1 INNER JOIN Scoring AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.divID = 'EW' AND T1.tmID = 'BIR' AND T1.year = 1976
hockey
In 2010, how many loses made by team 'BOS' and how many assists were made by the players?
year = 2010; BOS refers to tmID; loses refer to L; assists refer to A;
SELECT SUM(T1.L), SUM(T2.A) FROM Teams AS T1 INNER JOIN Scoring AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.tmID = 'BOS' AND T1.year = 2010
hockey
Who is the shortest player and state the team ID of that player from 1925 to 1936.
Shortest refers to MIN(height); from 1925 to 1936 refers to year between 1925 and 1936;
SELECT T2.playerID, T2.tmID FROM ( SELECT playerID FROM Master WHERE height IS NOT NULL ORDER BY height ASC LIMIT 1 ) AS T1 INNER JOIN ( SELECT DISTINCT playerID, tmID FROM Scoring WHERE year BETWEEN 1925 AND 1936 ) AS T2 ON T1.playerID = T2.playerID
hockey
Which team has the highest winning rate in year 2000? State the team ID and list down the birth country of it's players.
MAX(DIVIDE(COUNT(W), SUM(COUNT(W), (COUNT (L)) where year = 2000;
SELECT DISTINCT T3.tmID, T1.birthCountry FROM Master AS T1 INNER JOIN Scoring AS T2 ON T1.playerID = T2.playerID INNER JOIN ( SELECT year, tmID FROM Teams WHERE year = 2000 ORDER BY W / (W + L) DESC LIMIT 1 ) AS T3 ON T2.tmID = T3.tmID AND T2.year = T3.year
world
Which country has the shortest life expectancy?
shortest life expectancy refers to MIN(LifeExpectancy);
SELECT Name FROM Country ORDER BY LifeExpectancy LIMIT 1
world
List any five countries which use English as an official language.
English as an official language refers to `Language` = 'English' AND IsOfficial = 'T';
SELECT T1.Name FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'English' AND T2.IsOfficial = 'T' LIMIT 5
world
Calculate the average population per city in Karnataka district.
average population = AVG(Population);
SELECT AVG(Population) FROM City WHERE District = 'Karnataka' GROUP BY ID
world
List the languages used in the USA.
USA refers to CountryCode = 'USA';
SELECT Language FROM CountryLanguage WHERE CountryCode = 'USA'
world
How many countries use Portuguese?
Portuguese refers to `Language` = 'Portuguese';
SELECT SUM(CASE WHEN Language = 'Portuguese' THEN 1 ELSE 0 END) FROM CountryLanguage
world
How many cities are there in England?
England refers to District = 'England';
SELECT COUNT(ID) FROM City WHERE District = 'England'
world
How many cities are there in the country with the largest surface area?
largest surface area refers to MAX(SurfaceArea);
SELECT T2.ID FROM Country AS T1 INNER JOIN City AS T2 ON T1.Code = T2.CountryCode WHERE T1.SurfaceArea = ( SELECT MAX(SurfaceArea) FROM Country )
world
What is the capital city and population of San Marino?
capital city refers to Capital; San Marino is a name of country;
SELECT T1.Capital, T2.Population FROM Country AS T1 INNER JOIN City AS T2 ON T1.Code = T2.CountryCode WHERE T1.Name = 'San Marino'
world
List the languages used in Turkmenistan.
Turkmenistan is a name of country;
SELECT T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Name = 'Turkmenistan'
world
Provide the name, capital city and its official language of the country with the highest life expectancy.
capital city refers to Capital; official language refers to IsOfficial = 'T'; highest life expectancy refers to MAX(LifeExpectancy);
SELECT T1.Name, T1.Capital, T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode INNER JOIN City AS T3 ON T1.Code = T3.CountryCode WHERE T2.IsOfficial = 'T' ORDER BY T1.LifeExpectancy DESC LIMIT 1
world
List any five countries which use English as an official language.
English as an official language refers to `Language` = 'English' AND IsOfficial = 'T';
SELECT T1.Name FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'English' AND T2.IsOfficial = 'T' LIMIT 5
world
Among the languages used in Baltic Countries, provide the languages which are used by over 80%.
Baltic Countries refers to Region = 'Baltic Countries'; languages which are used by over 80% refers to Percentage > 80;
SELECT T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Region = 'Baltic Countries' AND T2.Percentage > 80
world
Among the languages used in Baltic Countries, provide the languages which are used by over 80%.
Baltic Countries refers to Region = 'Baltic Countries'; languages which are used by over 80% refers to Percentage > 80;
SELECT T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Region = 'Baltic Countries' AND T2.Percentage > 80
world
Provide the name, located country, and life expectancy of the most populated city
most populated city refers to MAX(Population);
SELECT T2.Name, T1.Code, T1.LifeExpectancy FROM Country AS T1 INNER JOIN City AS T2 ON T1.Code = T2.CountryCode ORDER BY T2.Population DESC LIMIT 1
world
Describe the capital city and languages used in the country with the shortest life expectancy.
capital city refers to Capital; shortest life expectancy refers to MIN(LifeExpectancy);
SELECT T1.Capital, T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode INNER JOIN City AS T3 ON T1.Code = T3.CountryCode ORDER BY T1.LifeExpectancy LIMIT 1
world
Provide the country, population, capital city, and official language of the country with the smallest surface area.
capital city refers to Capital; official language refers to IsOfficial = 'T'; smallest surface area refers to MIN(SurfaceArea);
SELECT T1.Name, T1.Population, T1.Capital, T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode INNER JOIN City AS T3 ON T1.Code = T3.CountryCode WHERE T2.IsOfficial = 'T' ORDER BY T1.SurfaceArea LIMIT 1
world
List the district name of the city with the smallest population.
smallest population refers to MIN(Population);
SELECT District FROM City ORDER BY Population LIMIT 1
world
In which continent does the country with the smallest surface area belongs?
smallest surface area refers to MIN(smallest surface area);
SELECT Continent FROM Country ORDER BY SurfaceArea LIMIT 1
world
Who is the head of the state where the most crowded city belongs?
head of the state refers to HeadOfState; most crowded city refers to MAX(Population);
SELECT T1.HeadOfState FROM Country AS T1 INNER JOIN City AS T2 ON T1.Code = T2.CountryCode ORDER BY T2.Population DESC LIMIT 1
world
Among the countries that officially use the English language, what country has the highest capital?
officially use the English language refers to `Language` = 'English' AND IsOfficial = 'T'; highest capital refers to MAX(Capital);
SELECT T1.Code FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'English' AND T2.IsOfficial = 'T' ORDER BY T1.Capital DESC LIMIT 1
world
Give the head of the state of the country with the lowest percentage use of English as their language.
head of the state refers to HeadOfState; lowest percentage use of English as their language refers to MIN(Percentage WHERE `Language` = 'English');
SELECT T1.HeadOfState FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'English' ORDER BY T2.Percentage LIMIT 1
world
What is the surface area of the country where Sutton Coldfield city belongs?
SELECT T1.SurfaceArea FROM Country AS T1 INNER JOIN City AS T2 ON T1.Code = T2.CountryCode WHERE T2.Name = 'Sutton Coldfield'
world
List down the languages of the countries that have population below 8000.
population below 8000 refers to Population < 8000;
SELECT T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Population < 8000
world
What are the official languages used in Belgium?
official languages refers to IsOfficial = 'T'; Belgium is a name of country;
SELECT T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Name = 'Belgium' AND T2.IsOfficial = 'T'
world
Give the cities and district names that belong to the country with Hajastan as its local name.
SELECT T2.Name, T2.District FROM Country AS T1 INNER JOIN City AS T2 ON T1.Code = T2.CountryCode WHERE T1.LocalName = 'Hajastan'
world
How many languages are used in Cyprus?
Cyprus is a name of Country;
SELECT SUM(CASE WHEN T1.Name = 'Cyprus' THEN 1 ELSE 0 END) FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode
world
Provide the language used by the people of Belize.
Belize is a name of country;
SELECT T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Name = 'Belize'
world
List down the districts belong to the country headed by Adolf Ogi.
headed by Adolf Ogi refers to HeadOfState = 'Adolf Ogi';
SELECT T2.District FROM Country AS T1 INNER JOIN City AS T2 ON T1.Code = T2.CountryCode WHERE T1.HeadOfState = 'Adolf Ogi'
world
Who is the head of the country where Santa Catarina district belongs?
head of the country refers to HeadOfState;
SELECT T1.HeadOfState FROM Country AS T1 INNER JOIN City AS T2 ON T1.Code = T2.CountryCode WHERE T2.District = 'Santa Catarina'
world
In English speaking countries, provide the difference between the number of countries with republic and constitutional monarchy as its government form.
English speaking refers to Language = 'English' ; difference = SUBTRACT(COUNT(Language = 'English' WHERE GovernmentForm = 'Republic'), COUNT(Language = 'English' WHERE GovernmentForm = 'ConstitutionalMonarchy'));
SELECT COUNT(T1.GovernmentForm = 'Republic') - COUNT(T1.GovernmentForm = 'ConstitutionalMonarchy') FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'English'
world
What country declared its independence in 1994?
declared independence in 1994 refers to IndepYear = 1994;
SELECT Name FROM Country WHERE IndepYear = 1994
world
List all the countries in Asia.
Asia refers to Continent = 'Asia';
SELECT Name FROM Country WHERE Continent = 'Asia'
world
What country in Asia has the largest gross national product(GNP)?
Asia refers to Continent = 'Asia'; largest gross national product refers to MAX(GNP);
SELECT Name FROM Country WHERE Continent = 'Asia' ORDER BY GNP DESC LIMIT 1
world
How many cities are in the Philippines?
Philippines refers to CountryCode = 'PHL';
SELECT COUNT(ID) FROM City WHERE Name = 'PHL'
world
What is the local name of Ukraine that they are also known for?
Ukraine is a name of country;
SELECT LocalName FROM Country WHERE Name = 'Ukraine'
world
How many countries have Socialistic Republic form of government?
Socialistic Republic form of government refers to GovernmentForm = 'Socialistic Republic';
SELECT COUNT(Code) FROM Country WHERE GovernmentForm = 'Socialistic Republic'
world
What is the official language of China?
official language refers to IsOfficial = 'T'; China is a name of country;
SELECT T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Name = 'China' AND T2.IsOfficial = 'T'
world
How many percent of the population of China used Chinese as their language?
percent refers to Percentage; China is a name of country; use Chinese as their language refers to Language = 'Chinese';
SELECT T2.Percentage FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Name = 'China' AND T2.Language = 'Chinese'
world
What is the form of government that the city of Manila has?
form of government refers to GovernmentForm;
SELECT T1.GovernmentForm FROM Country AS T1 INNER JOIN City AS T2 ON T1.Code = T2.CountryCode WHERE T2.Name = 'Manila'
world
List all the languages used in Europe.
Europe refers to Continent = 'Europe';
SELECT T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Continent = 'Europe'
world
Who is the head of state of the country where the city of Pyongyang is under?
SELECT T1.HeadOfState FROM Country AS T1 INNER JOIN City AS T2 ON T1.Code = T2.CountryCode WHERE T2.Name = 'Pyongyang'
world
How many unofficial languages are used in Italy?
unofficial languages refers to IsOfficial = 'F'; Italy is a name of country;
SELECT SUM(CASE WHEN T2.IsOfficial = 'F' THEN 1 ELSE 0 END) FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Name = 'Italy'
world
What city in Russia has the least population?
Russia is a name of country; least population refers to MIN(Population);
SELECT T2.Name FROM Country AS T1 INNER JOIN City AS T2 ON T1.Code = T2.CountryCode WHERE T1.Name = 'Russian Federation' ORDER BY T2.Population ASC LIMIT 1
world
List all the cities in the country where there is high life expectancy at birth.
high life expectancy at birth refers to MAX(LifeExpectancy);
SELECT T2.Name FROM Country AS T1 INNER JOIN City AS T2 ON T1.Code = T2.CountryCode ORDER BY T1.LifeExpectancy DESC LIMIT 1
world
List all the official and unofficial languages used by the country that declared its independence in 1830.
official language refers to IsOfficial = 'T'; unofficial language refers to IsOfficial = 'F'; declared independence in 1830 refers to IndepYear = 1830;
SELECT T2.Language, T2.IsOfficial FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.IndepYear = 1830 GROUP BY T2.Language, T2.IsOfficial
world
What is the capital city of the country with largest population?
capital city refers to Capital; largest population refers to MAX(Population);
SELECT T1.Capital FROM Country AS T1 INNER JOIN City AS T2 ON T1.Code = T2.CountryCode ORDER BY T1.Population DESC LIMIT 1
world
List all the countries in the continent of Asia that use English as their unofficial language.
use English as unofficial language refers to Language = 'English' WHERE IsOfficial = 'F';
SELECT T1.Name FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Continent = 'Asia' AND T2.IsOfficial = 'F' GROUP BY T1.Name
world
Calculate the average GNP of all countries that use Arabic language.
average GNP = AVG(GNP); use Arabic language refers to Language = 'Arabic';
SELECT AVG(T1.GNP) FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'Arabic'
world
Which country has the smallest surface area?
smallest surface area refers to MIN(smallest surface area);
SELECT Name FROM Country ORDER BY SurfaceArea ASC LIMIT 1
world
Write down the name of the largest population country.
largest population refers to MAX(Population);
SELECT Name FROM Country ORDER BY Population DESC LIMIT 1
world
What is the language of the smallest population country?
smallest population refers to MIN(Population);
SELECT T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode ORDER BY T1.Population ASC LIMIT 1
world
List down the name of countries whereby English is their official language.
English is the official language refers to Language = 'English' AND IsOfficial = 'T';
SELECT T1.Name FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'English' AND T2.IsOfficial = 'T'
world
List down the official language of the countries which declared independence after 1990,
official lanaguage refers to IsOfficial = 'T'; declared independence after 1990 refers to IndepYear > 1990;
SELECT T1.Name, T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.IndepYear > 1990 AND T2.IsOfficial = 'T'
world
What is the percentage of English used in Australia?
English refers to Language = 'English'; Australia is a name of country;
SELECT T2.Percentage FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Name = 'Australia' AND T2.Language = 'English'
world
List down languages used in Malaysia.
Malaysia is a name of country;
SELECT T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Name = 'Malaysia'
world
Which country has the most crowded city in the world?
most crowded city refers to MAX(Population);
SELECT T1.Name FROM Country AS T1 INNER JOIN City AS T2 ON T1.Code = T2.CountryCode ORDER BY T2.Population DESC LIMIT 1
world
What is the life expectancy of residents in the most crowded city?
most crowded city refers to MAX(Population);
SELECT T2.LifeExpectancy FROM City AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.Code ORDER BY T1.Population DESC LIMIT 1
world
What is the GNP of the least crowded city in the world?
least crowded city refers to MIN(Population);
SELECT T2.GNP FROM City AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.Code ORDER BY T1.Population ASC LIMIT 1
world
Within the 5 most crowded cities in the world, which country has the most languages used?
most crowded cities refers to MAX(Population); has the most languages used refers to MAX(COUNT(Language));
SELECT Name FROM ( SELECT T1.Name, T2.Language FROM City AS T1 INNER JOIN CountryLanguage AS T2 ON T1.CountryCode = T2.CountryCode GROUP BY T1.Name, T1.Population, T2.Language ORDER BY T1.Population DESC ) AS T3 GROUP BY t3.Name ORDER BY COUNT(Language) DESC LIMIT 1
world
Which country has the smallest surface area and the most crowded city?
smallest surface area refers to MIN(smallest surface area); most crowded city refers to MAX(Population);
SELECT T2.Name FROM City AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.Code ORDER BY T1.Population DESC, T2.SurfaceArea DESC LIMIT 1
world
List down all cities of China.
China is a name of country;
SELECT T1.Name FROM City AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.Code WHERE T2.Name = 'China'
world
What is the average life expentancy of countries that speak Arabic?
average life expectancy = AVG(LifeExpectancy); speak Arabic refers to `Language` = 'Arabic';
SELECT AVG(T1.LifeExpectancy) FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'Arabic'
world
What is the GNP growth rate by the country of Shanghai?
GNP growth rate = DIVIDE(SUBTRACT(GNP, GNPOld), GNPOld); Shanghai is a name of city;
SELECT CAST((T1.GNP - T1.GNPOld) AS REAL) / T1.GNPOld FROM Country AS T1 INNER JOIN City AS T2 ON T1.Code = T2.CountryCode WHERE T2.Name = 'Shanghai'
world
What is the district of Zaanstad?
Zaanstad is a name of city;
SELECT District FROM City WHERE name = 'Zaanstad'