Chinastark/bird_dataset huggingface dataset:
Database: hockey
Note: have died means deathyear is not NUll; Buffalo sabres is the name of team;
Question: How many coaches who have taught the Buffalo Sabres have died?
SQL: SELECT count(DISTINCT master.coachid) FROM coaches INNER JOIN teams ON coaches.year = teams.year AND coaches.tmid = teams.tmid INNER JOIN master ON coaches.coachid = master.coachid WHERE teams.name = 'Buffalo Sabres' AND master.deathyear IS NOT NULL
Database: hockey
Note: from the Usa refers to birthcountry = 'Usa'; nick names of the coaches refer to namenick where coachid is not NUll ; Buffalo sabres is the name of team;
Question: Please list the nick names of the coaches who are from the USA and have taught the Buffalo Sabres.
SQL: SELECT DISTINCT namenick FROM coaches INNER JOIN teams ON coaches.year = teams.year AND coaches.tmid = teams.tmid INNER JOIN master ON coaches.coachid = master.coachid WHERE teams.name = 'Buffalo Sabres' AND master.birthcountry = 'USA'
Database: hockey
Note: from the Usa refers to birthcountry = 'Usa'; year = 1922;
Question: Among the coaches who taught the teams in 1922's Stanley Cup finals, how many of them are from the USA?
SQL: SELECT count(DISTINCT master.coachid) FROM coaches INNER JOIN teamssc ON coaches.year = teamssc.year AND coaches.tmid = teamssc.tmid INNER JOIN master ON coaches.coachid = master.coachid WHERE teamssc.year = 1922 AND master.birthcountry = 'USA'
Database: hockey
Note: which team played the most games against refers to oppid where MaX(sUM(g); Buffalo sabres is the name of team;
Question: In the year 2000, which team has played the most games against the Buffalo Sabres?
SQL: SELECT teams.name FROM teamvsteam INNER JOIN teams ON teamvsteam.year = teams.year AND teamvsteam.oppid = teams.tmid INNER JOIN teams ON teamvsteam.year = teams.year AND teamvsteam.tmid = teams.tmid WHERE teamvsteam.year = 2000 AND teams.name = 'Buffalo Sabres' GROUP BY teams.name ORDER BY sum(teams.g) DESC LIMIT 1
Database: hockey
Note: teams that have played against refer to oppid; Buffalo sabres is the name of team;
Question: Please list the names of all the teams that have played against the Buffalo Sabres.
SQL: SELECT DISTINCT teams.name FROM teamvsteam INNER JOIN teams ON teamvsteam.year = teams.year AND teamvsteam.oppid = teams.tmid INNER JOIN teams ON teamvsteam.year = teams.year AND teamvsteam.tmid = teams.tmid WHERE teams.name = 'Buffalo Sabres'
Database: hockey
Note: penalty minutes refer to pim; year = 1918; Montreal Canadiens is name of team;
Question: How many penalty minutes did the Montreal Canadiens have in the 1918's Stanley Cup Finals?
SQL: SELECT teamssc.pim FROM teams INNER JOIN teamssc ON teams.tmid = teamssc.tmid AND teams.year = teamssc.year WHERE teams.name = 'Montreal Canadiens' AND teams.year = 1918
Database: hockey
Note: penalty minutes refer to pim = 24; wins refer to w;
Question: In the year that the Montreal Canadiens had 24 penalty minutes in the Stanley Cup finals, how many wins did the team had in total?
SQL: SELECT teamssc.w FROM teams INNER JOIN teamssc ON teams.tmid = teamssc.tmid AND teams.year = teamssc.year WHERE teams.name = 'Montreal Canadiens' AND teamssc.pim = 24
Database: hockey
Note: penalty minutes refer to pim = 49;
Question: In which year did the Montreal Canadiens have 49 penalty minutes in the Stanley Cup finals? Was it 1924, 1923 or 1918?
SQL: SELECT teams.year FROM teams INNER JOIN teamssc ON teams.tmid = teamssc.tmid AND teams.year = teamssc.year WHERE teams.name = 'Montreal Canadiens' AND teamssc.pim = 49
Database: hockey
Note: the first one refers to min(year);
Question: Which coach was the first one to teach the Montreal Canadiens, please give his first name.
SQL: SELECT master.firstname FROM coaches INNER JOIN teams ON coaches.tmid = teams.tmid AND coaches.year = teams.year INNER JOIN master ON coaches.coachid = master.coachid WHERE teams.name = 'Montreal Canadiens' ORDER BY coaches.year LIMIT 1
Database: hockey
Note: dividE(sUM(dividE(w,g), COUNt(oppid) where year = 2000; Montreal Canadiens is name of team;
Question: What is the average winning rate of the Buffalo Sabres in 2000?
SQL: SELECT sum(cast(teams.w AS REAL) / teams.g) / count(teamvsteam.oppid) FROM teamvsteam INNER JOIN teams ON teamvsteam.year = teams.year AND teamvsteam.tmid = teams.tmid WHERE teams.name = 'Buffalo Sabres' AND teamvsteam.year = 2000
Database: hockey
Note: aVg(pim) = dividE(sUM(pim), COUNt(g)); Montreal Canadiens is name of team;
Question: How many penalty minutes did the Montreal Canadiens have on average in the Stanley Cup Finals?
SQL: SELECT cast(sum(teamssc.pim) AS REAL) / count(teamssc.pim) FROM teams INNER JOIN teamssc ON teams.tmid = teamssc.tmid AND teams.year = teamssc.year WHERE teams.name = 'Montreal Canadiens'
Database: hockey
Note: dividE(sUM(dividE(w,g), COUNt(oppid);
Question: What is the average winning rate of the Montreal Canadiens in the Stanley Cup finals?
SQL: SELECT sum(teamssc.w / teamssc.g) / sum(teamssc.g + teamssc.w) FROM teams INNER JOIN teamssc ON teams.tmid = teamssc.tmid AND teams.year = teamssc.year WHERE teams.name = 'Montreal Canadiens'
Database: hockey
Note: american refers to birthcountry = 'Usa'; dividE(COUNt(coachid where birthcountry = 'Usa', name` = 'Montreal Canadiens'), COUNt(coachid where name` = 'Montreal Canadiens')) as percentage;
Question: What is the percentage of American coaches among all the coaches who taught the Montreal Canadiens?
SQL: SELECT sum(cast(teamssc.w AS REAL) / teamssc.g) / sum(teamssc.g + teamssc.w) FROM teams INNER JOIN teamssc ON teams.tmid = teamssc.tmid AND teams.year = teamssc.year WHERE teams.name = 'Montreal Canadiens'
Database: hockey
Note: latest refers to MaX(year); non player/builder refers to category = NOt IN ('player', 'builder');
Question: Who was the latest non player/builder to become the hall of famer? Give the full name.
SQL: SELECT name FROM hof WHERE category IN ('Player', 'Builder') ORDER BY YEAR DESC LIMIT 1
Database: hockey
Note: 1970s refers to year between 1970 and 1979; referees stand for category;
Question: For all the referees, who became a hall of famer in the 1970s? What's his hofID?
SQL: SELECT name, hofid FROM hof WHERE category = 'Builder' AND YEAR BETWEEN 1970 AND 1979
Database: hockey
Note: hall of famers refers to hofid; players stand for category;
Question: In the year 1958, what is the total number of players that became hall of famers?
SQL: SELECT count(hofid) FROM hof WHERE category = 'Player' AND YEAR = 1958
Database: hockey
Note: hall of famers refers to hofid; both played and coached means playerid is not NUll and coachid is not NUll;
Question: How many hall of famers both played and coached in the league?
SQL: SELECT count(playerid) FROM master WHERE hofid IS NOT NULL AND playerid IS NOT NULL AND coachid IS NOT NULL
Database: hockey
Note: played in the league but not coached means playerid is not NUll and coachid is NUll;
Question: What is the number of players whose last name is Green that played in the league but not coached?
SQL: SELECT count(playerid) FROM master WHERE lastname = 'Green' AND coachid IS NULL
Database: hockey
Note: bench minor penalties refer to benchminor; scotty Bowman is a coach; year = 1982;
Question: For the team that Scotty Bowman coached in 1982, how many bench minor penalties did they have that year?
SQL: SELECT teams.benchminor FROM coaches INNER JOIN teams ON coaches.year = teams.year AND coaches.tmid = teams.tmid INNER JOIN master ON coaches.coachid = master.coachid WHERE master.firstname = 'Scotty' AND master.lastname = 'Bowman' AND coaches.year = 1982
Database: hockey
Note: 10 empty net goals refer to eng = 10; tallest refers to MaX(height);
Question: Among the players who had 10 empty net goals in their career, who is the tallest? Show his full name.
SQL: SELECT master.firstname, master.lastname FROM goalies INNER JOIN master ON goalies.playerid = master.playerid WHERE goalies.eng = 10 ORDER BY master.height DESC LIMIT 1
Database: hockey
Note: the dominant hand refers to shootcatch; year = 1973; tmid = 'QUN'; played 32 games refers to gp = 32;
Question: Which was the dominant hand for the goaltender who played 32 games for QUN in 1973? Give the full name.
SQL: SELECT master.shootcatch, master.firstname, master.lastname FROM goalies INNER JOIN master ON goalies.playerid = master.playerid AND goalies.year = 1973 WHERE goalies.tmid = 'QUN' AND goalies.gp = 32
Database: hockey
Note: goalie is a players; teams refer to tmid;
Question: For the goalie whose last name is "Young", how many teams did he play in?
SQL: SELECT count(DISTINCT goalies.tmid) FROM goalies INNER JOIN master ON goalies.playerid = master.playerid WHERE master.lastname = 'Young'
Database: hockey
Note: BOs refers to tmid = 'BOs'; year = 1972; became a coach than a Hall of Famer means coachid is not NUll and hofid is NUll;
Question: For the goalkeeper that became a coach than a Hall of Famer, who played for BOS in 1972?
SQL: SELECT master.firstname, master.lastname , iif(goalies.tmid = 'BOS', 'YES', 'NO') FROM goalies INNER JOIN master ON goalies.playerid = master.playerid WHERE goalies.year = 1972 AND goalies.tmid = 'BOS' AND master.coachid IS NOT NULL AND master.hofid IS NULL
Database: hockey
Question: For the goalie whose legendsID is "P196402" , how many games did he play in the league?
SQL: SELECT sum(goalies.gp) FROM goalies INNER JOIN master ON goalies.playerid = master.playerid WHERE master.legendsid = 'P196402'
Database: hockey
Note: the most play minutes refer to MaX(min); goalie refers to pos = 'g'; New York Islanders is the nameof team;
Question: In the history of all the Quebec Bulldogs, which goalie had the most play minutes for the team? Give the full name.
SQL: SELECT master.firstname, master.lastname FROM goalies INNER JOIN master ON goalies.playerid = master.playerid INNER JOIN teams ON goalies.tmid = teams.tmid AND goalies.year = teams.year WHERE teams.name = 'Quebec Bulldogs' AND master.pos = 'D' GROUP BY goalies.playerid, master.firstname, master.lastname ORDER BY sum(goalies.min) DESC LIMIT 1
Database: hockey
Note: Calgary Flames is the name of team;
Question: How many goalies played for Calgary Flames?
SQL: SELECT count(DISTINCT playerid) FROM goalies INNER JOIN teams ON goalies.tmid = teams.tmid AND goalies.year = teams.year WHERE teams.name = 'Calgary Flames'
Database: hockey
Note: goals against are the number of goals recorded while the goalie is on the ice; the most goal againsts refers to MaX(ga); minnesota North stars is name of team;
Question: Which Minnesota North Stars' goalkeeper had the most Goal Againsts in his play time?
SQL: SELECT playerid FROM goalies INNER JOIN teams ON goalies.tmid = teams.tmid AND goalies.year = teams.year WHERE teams.name = 'Minnesota North Stars' GROUP BY goalies.playerid ORDER BY sum(goalies.ga) DESC LIMIT 1
Database: hockey
Note: hall of famers refers to hofid where playerid is not NUll;
Question: How many Haileybury Hockey Club goalies became a hall of famer?
SQL: SELECT count(DISTINCT goalies.playerid) FROM goalies INNER JOIN master ON goalies.playerid = master.playerid INNER JOIN teams ON goalies.tmid = teams.tmid AND goalies.year = teams.year WHERE teams.name = 'Haileybury Hockey Club' AND master.hofid IS NOT NULL
Database: hockey
Note: the most shutouts refer to MaX(sho); catching hand refers to shootcatch; year = 2010;
Question: For the goalie who had the most shutouts in 2010, what's his catching hand?
SQL: SELECT master.shootcatch FROM goalies INNER JOIN master ON goalies.playerid = master.playerid WHERE goalies.year = 2010 GROUP BY master.shootcatch ORDER BY sum(goalies.sho) DESC LIMIT 1
Database: hockey
Note: dividE(sUBtRaCt(sUM(gp(year = 2005), sUM(gp(year = 2006)), sUM(gp(year = 2005)) as percentage;
Question: What's the decrease rate of the game plays did David Aebischer after he got traded in 2005?
SQL: SELECT cast((sum(CASE WHEN goalies.year = 2005 THEN goalies.gp ELSE 0 END) - sum(CASE WHEN goalies.year = 2006 THEN goalies.gp ELSE 0 END)) AS REAL) * 100 / sum(CASE WHEN goalies.year = 2005 THEN goalies.gp ELSE 0 END) FROM goalies INNER JOIN master ON goalies.playerid = master.playerid WHERE master.firstname = 'David' AND master.lastname = 'Aebischer'
Database: hockey
Note: after retirement means playerid Iis not NUll and coachid is not NUll;
Question: State the player ID and coach ID of person who have become coach after retirement.
SQL: SELECT playerid, coachid FROM master WHERE playerid IS NOT NULL AND coachid IS NOT NULL
Database: hockey
Note: average height of 75 refers to aVg(height) = 75;
Question: State the player ID of player with average height of 75.
SQL: SELECT DISTINCT playerid FROM master GROUP BY playerid HAVING avg(height) = 75
Database: hockey
Note: 5 heaviest players refer to MaX(weight) limit to 5 playerid;
Question: Who is the heaviest player? State player ID of 5 heaviest players.
SQL: SELECT playerid FROM master ORDER BY weight DESC LIMIT 5
Database: hockey
Note: origin from Finland refers to birthcountry = 'Finland';
Question: What is the full name of players origin from Finland?
SQL: SELECT DISTINCT firstname, lastname FROM master WHERE birthcountry = 'Finland'
Database: hockey
Note: passed away means deathyear is not NUll;
Question: List down player ID of players who have passed away.
SQL: SELECT DISTINCT playerid FROM master WHERE deathyear IS NOT NULL AND playerid IS NOT NULL
Database: hockey
Note: after year 2000 refers to year>2000;
Question: List down the first name of coaches who still coach after year 2000.
SQL: SELECT DISTINCT master.firstname FROM master INNER JOIN coaches ON master.coachid = coaches.coachid WHERE coaches.year > 2000
Database: hockey
Note: year = 1930;
Question: What is the height and weight for coaches who have won awards in 1930?
SQL: SELECT master.height, master.weight FROM master INNER JOIN awardscoaches ON master.coachid = awardscoaches.coachid WHERE awardscoaches.year = '1930'
Database: hockey
Note: total goals refer to sUM(g); how old = sUBtRaCt(year(CURdate, birthyear);
Question: How much is the total goals for player with player ID aaltoan01 and how old is this person?
SQL: SELECT sum(scoring.g), strftime('%Y', CURRENT_TIMESTAMP) - master.birthyear FROM master INNER JOIN scoring ON master.playerid = scoring.playerid WHERE master.playerid = 'aaltoan01' GROUP BY master.birthyear
Database: hockey
Note: coach who has not been a player means playerid is NUll and coachid is not NUll;
Question: Is there any coach who has not been a player before but has won award? State the ID.
SQL: SELECT DISTINCT awardscoaches.coachid FROM master INNER JOIN awardscoaches ON master.coachid = awardscoaches.coachid WHERE master.playerid IS NULL
Database: hockey
Note: left winger refers to pos = 'l'; weight>200;
Question: Which player ID are left winger and weight more than 200?
SQL: SELECT DISTINCT playerid FROM master WHERE pos LIKE '%L%' AND weight > 200 AND playerid IS NOT NULL AND pos = 'L'
Database: hockey
Note: game played refers to gp; from Usa refers to birthcountry = 'Usa';
Question: What is the total number of game played for players from USA?
SQL: SELECT count(scoring.gp) FROM master INNER JOIN scoring ON master.playerid = scoring.playerid WHERE master.birthcountry = 'USA'
Database: hockey
Note: points scored refers to pts; team id refers to tmid;
Question: Calculate the total points scored by team ID ANA and list down the coashes of the team.
SQL: SELECT sum(teams.pts), coaches.coachid FROM coaches INNER JOIN teams ON teams.tmid = coaches.tmid WHERE teams.tmid = 'ANA' GROUP BY coaches.coachid
Database: hockey
Note: year = 1976; BIR refers to tmid; Division 'Ew' refers to divid = 'Ew'; goals = g;
Question: In 1976, how many goals achieved by team 'BIR' in Division 'EW'?
SQL: SELECT sum(scoring.g) FROM teams INNER JOIN scoring ON teams.tmid = scoring.tmid AND teams.year = scoring.year WHERE teams.divid = 'EW' AND teams.tmid = 'BIR' AND teams.year = 1976
Database: hockey
Note: year = 2010; BOs refers to tmid; loses refer to l; assists refer to a;
Question: In 2010, how many loses made by team 'BOS' and how many assists were made by the players?
SQL: SELECT sum(teams.l), sum(scoring.a) FROM teams INNER JOIN scoring ON teams.tmid = scoring.tmid AND teams.year = scoring.year WHERE teams.tmid = 'BOS' AND teams.year = 2010
Database: hockey
Note: aNa refers to tmid;
Question: What are the total weights of players for team 'ANA' as per year 1997?
SQL: SELECT sum(master.weight) FROM master INNER JOIN scoring ON master.playerid = scoring.playerid WHERE scoring.year = 1997 AND scoring.tmid = 'ANA'
Database: hockey
Note: shortest refers to min(height); from 1925 to 1936 refers to year between 1925 and 1936;
Question: Who is the shortest player and state the team ID of that player from 1925 to 1936.
SQL: 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
Database: hockey
Note: MaX(dividE(COUNt(w), sUM(COUNt(w), (COUNt (l)) where year = 2000;
Question: Which team has the highest winning rate in year 2000? State the team ID and list down the birth country of it's players.
SQL: SELECT DISTINCT t3.tmid, master.birthcountry FROM master INNER JOIN scoring ON master.playerid = scoring.playerid INNER JOIN ( SELECT YEAR, tmid FROM teams WHERE YEAR = 2000 ORDER BY w / (w + l) DESC LIMIT 1 ) AS t3 ON scoring.tmid = t3.tmid AND scoring.year = t3.year
Database: hockey
Note: year = 1998; wins per game played = dividE(w, g); CaR refers to tmid; contributed the most goals refers to MaX(g);
Question: In 1998, How many wins were made by team 'CAR' per game played? Who contributed the most goals? State the player ID.
SQL: SELECT cast(teams.w AS REAL) / teams.g, scoring.playerid FROM teams INNER JOIN scoring ON teams.tmid = scoring.tmid AND teams.year = scoring.year WHERE teams.tmid = 'CAR' AND teams.year = 1998 GROUP BY teams.w / teams.g, scoring.playerid ORDER BY sum(scoring.g) DESC LIMIT 1
Database: world
Note: shortest life expectancy refers to MIN(lifeexpectancy);
Question: Which country has the shortest life expectancy?
SQL: SELECT name FROM country ORDER BY lifeexpectancy LIMIT 1
Database: world
Note: English as an official language refers to `language` = 'English' AND isofficial = 'T';
Question: List any five countries which use English as an official language.
SQL: SELECT country.name FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode WHERE countrylanguage.language = 'English' AND countrylanguage.isofficial = 'T' LIMIT 5
Database: world
Note: average population = AVG(population);
Question: Calculate the average population per city in Karnataka district.
SQL: SELECT avg(population) FROM city WHERE district = 'Karnataka' GROUP BY id
Database: world
Note: USA refers to countrycode = 'USA';
Question: List the languages used in the USA.
SQL: SELECT LANGUAGE FROM countrylanguage WHERE countrycode = 'USA'
Database: world
Note: Portuguese refers to `language` = 'Portuguese';
Question: How many countries use Portuguese?
SQL: SELECT sum(CASE WHEN LANGUAGE = 'Portuguese' THEN 1 ELSE 0 END) FROM countrylanguage
Database: world
Note: England refers to district = 'England';
Question: How many cities are there in England?
SQL: SELECT count(id) FROM city WHERE district = 'England'
Database: world
Note: largest surface area refers to MAX(surfacearea);
Question: How many cities are there in the country with the largest surface area?
SQL: SELECT city.id FROM country INNER JOIN city ON country.code = city.countrycode WHERE country.surfacearea = ( SELECT max(surfacearea) FROM country )
Database: world
Note: capital city refers to capital; San Marino is a name of country;
Question: What is the capital city and population of San Marino?
SQL: SELECT country.capital, city.population FROM country INNER JOIN city ON country.code = city.countrycode WHERE country.name = 'San Marino'
Database: world
Note: Turkmenistan is a name of country;
Question: List the languages used in Turkmenistan.
SQL: SELECT countrylanguage.language FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode WHERE country.name = 'Turkmenistan'
Database: world
Note: capital city refers to capital; official language refers to isofficial = 'T'; highest life expectancy refers to MAX(lifeexpectancy);
Question: Provide the name, capital city and its official language of the country with the highest life expectancy.
SQL: SELECT country.name, country.capital, countrylanguage.language FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode INNER JOIN city ON country.code = city.countrycode WHERE countrylanguage.isofficial = 'T' ORDER BY country.lifeexpectancy DESC LIMIT 1
Database: world
Note: official language refers to isofficial = 'T'; Antarctica refers to continent = 'Antarctica';
Question: List the countries and their official languages in Antarctica.
SQL: SELECT country.name, countrylanguage.language FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode WHERE country.continent = 'Antarctica' AND countrylanguage.isofficial = 'T'
Database: world
Note: Baltic Countries refers to region = 'Baltic Countries'; languages which are used by over 80% refers to percentage > 80;
Question: Among the languages used in Baltic Countries, provide the languages which are used by over 80%.  
SQL: SELECT countrylanguage.language FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode WHERE country.region = 'Baltic Countries' AND countrylanguage.percentage > 80
Database: world
Note: Baltic Countries refers to region = 'Baltic Countries'; languages which are used by over 80% refers to percentage > 80;
Question: Among the languages used in Baltic Countries, provide the languages which are used by over 80%.
SQL: SELECT countrylanguage.language FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode WHERE country.region = 'Baltic Countries' AND countrylanguage.percentage > 80
Database: world
Note: most populated city refers to MAX(population);
Question: Provide the name, located country, and life expectancy of the most populated city
SQL: SELECT city.name, country.code, country.lifeexpectancy FROM country INNER JOIN city ON country.code = city.countrycode ORDER BY city.population DESC LIMIT 1
Database: world
Note: capital city refers to capital; shortest life expectancy refers to MIN(lifeexpectancy);
Question: Describe the capital city and languages used in the country with the shortest life expectancy.
SQL: SELECT country.capital, countrylanguage.language FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode INNER JOIN city ON country.code = city.countrycode ORDER BY country.lifeexpectancy LIMIT 1
Database: world
Note: capital city refers to capital; official language refers to isofficial = 'T'; smallest surface area refers to MIN(surfacearea);
Question: Provide the country, population, capital city, and official language of the country with the smallest surface area.
SQL: SELECT country.name, country.population, country.capital, countrylanguage.language FROM country INNER JOIN countrylanguage ON country.code = countrylanguage.countrycode INNER JOIN city ON country.code = city.countrycode WHERE countrylanguage.isofficial = 'T' ORDER BY country.surfacearea LIMIT 1
Database: world
Note: percentage = MULTIPLY(DIVidE(COUNT(language = 'English' WHERE continent = 'North America'), COUNT(language WHERE continent = 'North America')), 1.0); North America refers to continent = 'North America'; use English refers to language = 'English';
Question: How many percent of countries in North America use English?
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
Database: world
Note: smallest population refers to MIN(population);
Question: List the district name of the city with the smallest population.
SQL: SELECT district FROM city ORDER BY population LIMIT 1
Database: world
Note: smallest surface area refers to MIN(smallest surface area);
Question: In which continent does the country with the smallest surface area belongs?
SQL: SELECT continent FROM country ORDER BY surfacearea LIMIT 1