Chinastark/bird_dataset huggingface dataset:
Database: superhero
Note: power of superheroes refers to power_name; height greater than 80% of the average height of all superheroes = height_cm > MULTIPLY(AVG(height_cm), 0.8);
Question: List the power of superheroes with height greater than 80% of the average height of all superheroes.
SQL: SELECT superpower.power_name FROM superhero INNER JOIN hero_power ON superhero.id = hero_power.hero_id INNER JOIN superpower ON hero_power.power_id = superpower.id WHERE superhero.height_cm * 100 > ( SELECT avg(height_cm) FROM superhero ) * 80
Database: formula_1
Note: driver reference name refers to driverref; first qualifying period refers to q1; drivers who are eliminated in the first qualifying period refers to 5 drivers with MAX(q1); race number refers to raceid;
Question: Please list the reference names of the drivers who are eliminated in the first period in race number 20.
SQL: SELECT drivers.driverref FROM qualifying INNER JOIN drivers ON drivers.driverid = qualifying.driverid WHERE qualifying.raceid = 20 ORDER BY qualifying.q1 DESC LIMIT 5
Database: formula_1
Note: race number refers to raceid; second qualifying period refers to q2; best lap time refers to MIN(q2);
Question: What is the surname of the driver with the best lap time in race number 19 in the second qualifying period?
SQL: SELECT drivers.surname FROM qualifying INNER JOIN drivers ON drivers.driverid = qualifying.driverid WHERE qualifying.raceid = 19 ORDER BY qualifying.q2 ASC LIMIT 1
Database: formula_1
Note: Shanghai is a name of location;
Question: Please list the year during which the race is held on circuits in Shanghai.
SQL: SELECT races.year FROM circuits INNER JOIN races ON races.circuitid = circuits.circuitid WHERE circuits.location = 'Shanghai'
Database: formula_1
Note: introduction of races refers to url; Circuit de Barcelona-Catalunya is a name of circuit;
Question: Where can the introduction of the races held on Circuit de Barcelona-Catalunya be found?
SQL: SELECT DISTINCT circuits.url FROM circuits INNER JOIN races ON races.circuitid = circuits.circuitid WHERE circuits.name = 'Circuit de Barcelona-Catalunya'
Database: formula_1
Note: Germany is a name of country;
Question: Please give the name of the race held on the circuits in Germany.
SQL: SELECT DISTINCT races.name FROM circuits INNER JOIN races ON races.circuitid = circuits.circuitid WHERE circuits.country = 'Germany'
Database: formula_1
Note: Renault is a name of constructor;
Question: Please list the positions of the circuits built by the constructor Renault.
SQL: SELECT DISTINCT constructorstandings.position FROM constructorstandings INNER JOIN constructors ON constructors.constructorid = constructorstandings.constructorid WHERE constructors.name = 'Renault'
Database: formula_1
Question: How many races in the year 2010 are held on grand prixs outside Asia and Europe?
SQL: SELECT count(races.raceid) FROM circuits INNER JOIN races ON races.circuitid = circuits.circuitid WHERE circuits.country NOT IN ( 'Bahrain', 'China', 'Singapore', 'Japan', 'Korea', 'Turkey', 'UAE', 'Malaysia', 'Spain', 'Monaco', 'Azerbaijan', 'Austria', 'Belgium', 'France', 'Germany', 'Hungary', 'Italy', 'UK' ) AND races.year = 2010
Database: formula_1
Note: Spain is a name of country;
Question: Please give the names of the races held on the circuits in Spain.
SQL: SELECT DISTINCT races.name FROM circuits INNER JOIN races ON races.circuitid = circuits.circuitid WHERE circuits.country = 'Spain'
Database: formula_1
Note: coordinate position/location refers to lat, lng; circuits for Australian grand prix refers to races.name = 'Australian Grand Prix';
Question: What is the coordinates location of the circuits for Australian grand prix?
SQL: SELECT DISTINCT circuits.lat, circuits.lng FROM circuits INNER JOIN races ON races.circuitid = circuits.circuitid WHERE races.name = 'Australian Grand Prix'
Database: formula_1
Note: information about races refers to url;
Question: Where can I find the information about the races held on Sepang International Circuit?
SQL: SELECT DISTINCT circuits.url FROM circuits INNER JOIN races ON races.circuitid = circuits.circuitid WHERE circuits.name = 'Sepang International Circuit'
Database: formula_1
Question: Please list the time of the races held on Sepang International Circuit.
SQL: SELECT DISTINCT races.time FROM circuits INNER JOIN races ON races.circuitid = circuits.circuitid WHERE circuits.name = 'Sepang International Circuit'
Database: formula_1
Note: coordinate position/location refers to lat, lng; Abu Dhabi Grand Prix refers to races.name = 'Abu Dhabi Grand Prix';
Question: Give the coordinate position for Abu Dhabi Grand Prix.
SQL: SELECT DISTINCT circuits.lat, circuits.lng FROM circuits INNER JOIN races ON races.circuitid = circuits.circuitid WHERE races.name = 'Abu Dhabi Grand Prix'
Database: formula_1
Note: race number refers to raceid;
Question: Which country is the constructor which got 1 point in the race No. 24 from?
SQL: SELECT constructors.nationality FROM constructorresults INNER JOIN constructors ON constructors.constructorid = constructorresults.constructorid WHERE constructorresults.raceid = 24 AND constructorresults.points = 1
Database: formula_1
Note: race number refers to raceid; Bruno Senna refers to the full name of the driver; Full name of the driver refers to drivers.forename and drivers.surname;
Question: What's Bruno Senna's Q1 result in the qualifying race No. 354?
SQL: SELECT qualifying.q1 FROM qualifying INNER JOIN drivers ON drivers.driverid = qualifying.driverid WHERE qualifying.raceid = 354 AND drivers.forename = 'Bruno' AND drivers.surname = 'Senna'
Database: formula_1
Note: race number refers to raceid;
Question: For the driver who had the Q2 time as 0:01:40 in the qualifying race No. 355, what is his nationality?
SQL: SELECT DISTINCT drivers.nationality FROM qualifying INNER JOIN drivers ON drivers.driverid = qualifying.driverid WHERE qualifying.raceid = 355 AND qualifying.q2 LIKE '1:40%'
Database: formula_1
Note: race number refers to raceid; finished 0:0M:SS in the q3 refers to q3 LIKE 'M:SS%';
Question: What is his number of the driver who finished 0:01:54 in the Q3 of qualifying race No.903?
SQL: SELECT drivers.number FROM qualifying INNER JOIN drivers ON drivers.driverid = qualifying.driverid WHERE qualifying.raceid = 903 AND qualifying.q3 LIKE '1:54%'
Database: formula_1
Note: Bahrain Grand Prix refers to races.name = 'Bahrain Grand Prix'; drivers who finished the race refers to time is not empty (i.e. time IS NOT NULL);
Question: For the Bahrain Grand Prix in 2007, how many drivers not finished the game?
SQL: SELECT count(drivers.driverid) FROM races INNER JOIN results ON results.raceid = races.raceid INNER JOIN drivers ON drivers.driverid = results.driverid WHERE races.year = 2007 AND races.name = 'Bahrain Grand Prix' AND results.time IS NULL
Database: formula_1
Note: race number refers to raceid;
Question: Show me the season page of year when the race No. 901 took place.
SQL: SELECT seasons.url FROM races INNER JOIN seasons ON seasons.year = races.year WHERE races.raceid = 901
Database: formula_1
Note: game and race are synonyms; drivers who finished the race should have record in time;
Question: For the race happened on 2015/11/29, how many drivers finished the game?
SQL: SELECT count(results.driverid) FROM races INNER JOIN results ON results.raceid = races.raceid WHERE races.date = '2015-11-29' AND results.time IS NOT NULL
Database: formula_1
Note: drivers who finished the race refers to time is not empty (i.e. time IS NOT NULL); race number refers to raceid; date of birth refers to drivers.dob; The larger the birthday value, the younger the person is, and vice versa;
Question: For all the drivers who finished the game in race No. 592, who is the oldest?
SQL: SELECT drivers.forename, drivers.surname FROM drivers INNER JOIN results ON results.driverid = drivers.driverid WHERE results.raceid = 592 AND results.time IS NOT NULL AND drivers.dob IS NOT NULL ORDER BY drivers.dob ASC LIMIT 1
Database: formula_1
Note: player and driver are synonyms; the lap time of 0:0M:SS refers to laptime.time LIKE 'M:SS%';race number refers to raceid; introduction website of the drivers refers to url;
Question: Who was the player that got the lap time of 0:01:27 in the race No. 161? Show his introduction website.
SQL: SELECT DISTINCT drivers.forename, drivers.surname, drivers.url FROM laptimes INNER JOIN drivers ON drivers.driverid = laptimes.driverid WHERE laptimes.raceid = 161 AND laptimes.time LIKE '1:27%'
Database: formula_1
Note: fastest lap speed refers to MAX(fastestlapspeed);
Question: For the driver who set the fastest lap speed in race No.933, where does he come from?
SQL: SELECT drivers.nationality FROM drivers INNER JOIN results ON results.driverid = drivers.driverid WHERE results.raceid = 933 AND results.fastestlaptime IS NOT NULL ORDER BY results.fastestlapspeed DESC LIMIT 1
Database: formula_1
Note: location coordinates refers to (lat, lng); Malaysian Grand Prix refers to races.name = 'Malaysian Grand Prix';
Question: Where is Malaysian Grand Prix held? Give the location coordinates.
SQL: SELECT DISTINCT circuits.lat, circuits.lng FROM circuits INNER JOIN races ON races.circuitid = circuits.circuitid WHERE races.name = 'Malaysian Grand Prix'
Database: formula_1
Note: race number refers to raceid; constructor which got the highest point refers to MAX(constructorresults.points); introduction website of the constructor refers to url;
Question: For the constructor which got the highest point in the race No. 9 , what is its introduction website?
SQL: SELECT constructors.url FROM constructorresults INNER JOIN constructors ON constructors.constructorid = constructorresults.constructorid WHERE constructorresults.raceid = 9 ORDER BY constructorresults.points DESC LIMIT 1
Database: formula_1
Note: race number refers to raceid;
Question: What's Lucas di Grassi's Q1 result in the race No. 345?
SQL: SELECT qualifying.q1 FROM qualifying INNER JOIN drivers ON drivers.driverid = qualifying.driverid WHERE qualifying.raceid = 345 AND drivers.forename = 'Lucas' AND drivers.surname = 'di Grassi'
Database: formula_1
Note: race number refers to raceid;
Question: For the driver who had the Q2 time as 0:01:15 in race No. 347, where is he from?
SQL: SELECT DISTINCT drivers.nationality FROM qualifying INNER JOIN drivers ON drivers.driverid = qualifying.driverid WHERE qualifying.raceid = 347 AND qualifying.q2 LIKE '1:15%'
Database: formula_1
Note: race number refers to raceid; had the q3 time as 0:0M:SS refers to q3 LIKE 'M:SS%';
Question: In the race No. 45, for the driver who had the Q3 time as 0:01:33, what is his abbreviated code?
SQL: SELECT drivers.code FROM qualifying INNER JOIN drivers ON drivers.driverid = qualifying.driverid WHERE qualifying.raceid = 45 AND qualifying.q3 LIKE '1:33%'
Database: formula_1
Note: race number refers to raceid;
Question: What is the actual finish time for Bruce McLaren in the race No.743?
SQL: SELECT results.time FROM drivers INNER JOIN results ON results.driverid = drivers.driverid WHERE results.raceid = 743 AND drivers.forename = 'Bruce' AND drivers.surname = 'McLaren'
Database: formula_1
Note: finished second refers to position = 2;
Question: Who finished second in the San Marino Grand Prix in 2006?
SQL: SELECT drivers.forename, drivers.surname FROM races INNER JOIN results ON results.raceid = races.raceid INNER JOIN drivers ON drivers.driverid = results.driverid WHERE races.year = 2006 AND races.name = 'San Marino Grand Prix' AND results.position = 2
Database: formula_1
Note: the season page refers to url; race number refers to raceid;
Question: Show me the season page of year when the race No. 901 took place.
SQL: SELECT seasons.url FROM races INNER JOIN seasons ON seasons.year = races.year WHERE races.raceid = 901
Database: formula_1
Note: game and race are synonyms; drivers who didn't finish the race should have record in time;
Question: For the race happened in 2015/11/29, how many drivers did not finish the game?
SQL: SELECT count(results.driverid) FROM races INNER JOIN results ON results.raceid = races.raceid WHERE races.date = '2015-11-29' AND results.time IS NULL
Database: formula_1
Note: race number refers to raceid; drivers who finished the race refers to time has value; the youngest is a driver where MAX(dob);
Question: For all the drivers who finished the game in race No. 872, who is the youngest?
SQL: SELECT drivers.forename, drivers.surname FROM drivers INNER JOIN results ON results.driverid = drivers.driverid WHERE results.raceid = 872 AND results.time IS NOT NULL ORDER BY drivers.dob DESC LIMIT 1
Database: formula_1
Note: race number refers to raceid; the best lap time refers to MIN(time);
Question: Who was the driver that got the best lap time in the race No. 348? Give his full name.
SQL: SELECT drivers.forename, drivers.surname FROM laptimes INNER JOIN drivers ON drivers.driverid = laptimes.driverid WHERE laptimes.raceid = 348 ORDER BY laptimes.time ASC LIMIT 1
Database: formula_1
Note: the fastest lap speed refers to (MAX) fastestlapspeed;
Question: For the driver who set the fastest lap speed, what is his nationality?
SQL: SELECT drivers.nationality FROM drivers INNER JOIN results ON results.driverid = drivers.driverid ORDER BY results.fastestlapspeed DESC LIMIT 1
Database: formula_1
Note: Paul di Resta refers to the full name of the driver; Full name of the driver refers to drivers.forename ='Paul' and drivers.surname = 'di Resta'; race number refers to raceid; percentage = DIVIDE(SUBTRACT(fastestlapspeed(raceid = 853), (fastestlapspeed (raceid = 854)) * 100 , (fastestlapspeed(raceid = 853));
Question: Paul di Resta was in the No. 853 race, what percent faster did he finish in the 853rd race than the next race for the fastest lap speed?
SQL: SELECT (sum(iif(results.raceid = 853, results.fastestlapspeed, 0)) - sum(iif(results.raceid = 854, results.fastestlapspeed, 0))) * 100 / sum(iif(results.raceid = 853, results.fastestlapspeed, 0)) FROM drivers INNER JOIN results ON results.driverid = drivers.driverid WHERE drivers.forename = 'Paul' AND drivers.surname = 'di Resta'
Database: formula_1
Note: DIVIDE(COUNT(driverid when time has value ), (COUNT(driverid )) as percentage; in 1983/7/16 refers to when date = '1983-07-16';
Question: For the drivers who took part in the race in 1983/7/16, what's their race completion rate?
SQL: SELECT cast(count(CASE WHEN results.time IS NOT NULL THEN results.driverid END) AS REAL) * 100 / count(results.driverid) FROM races INNER JOIN results ON results.raceid = races.raceid WHERE races.date = '1983-07-16'
Database: formula_1
Note: the first race refers to race happened in min(year);
Question: Which year was the first Singapore Grand Prix?
SQL: SELECT YEAR FROM races WHERE name = 'Singapore Grand Prix' ORDER BY YEAR ASC LIMIT 1
Database: formula_1
Question: How many races were there in 2005? Name all the races in descending order.
SQL: SELECT name FROM races WHERE YEAR = 2005 ORDER BY name DESC
Database: formula_1
Note: earliest recorded year and month refers to year = year(min(date)) and month = month(min(date));
Question: List the names of all races that occurred in the earliest recorded year and month.
SQL: SELECT name FROM races WHERE strftime('%Y', date) = ( SELECT strftime('%Y', date) FROM races ORDER BY date ASC LIMIT 1 ) AND strftime('%m', date) = ( SELECT strftime('%m', date) FROM races ORDER BY date ASC LIMIT 1 )
Database: formula_1
Note: the last round refers to max(round);
Question: State the name and date of the last round of race in year 1999.
SQL: SELECT name, date FROM races WHERE YEAR = 1999 ORDER BY round DESC LIMIT 1
Database: formula_1
Note: the most number of races refers to max(round);
Question: Which year has the most number of races?
SQL: SELECT YEAR FROM races GROUP BY YEAR ORDER BY count(round) DESC LIMIT 1
Database: formula_1
Note: not hosted means not in;
Question: Name the races in year 2017 that are not hosted in year 2000.
SQL: SELECT name FROM races WHERE YEAR = 2017 AND name NOT IN ( SELECT name FROM races WHERE YEAR = 2000 )
Database: formula_1
Note: the first refers to min(year);
Question: In which country was the first European Grand Prix hosted? Name the circuit and location.
SQL: SELECT circuits.country, circuits.location FROM circuits INNER JOIN races ON races.circuitid = circuits.circuitid WHERE races.name = 'European Grand Prix' ORDER BY races.year ASC LIMIT 1
Database: formula_1
Note: the last refers to max(year);
Question: When was the last f1 season whereby Brands Hatch hosted the British Grand Prix?
SQL: SELECT races.date FROM circuits INNER JOIN races ON races.circuitid = circuits.circuitid WHERE circuits.name = 'Brands Hatch' AND races.name = 'British Grand Prix' ORDER BY races.year DESC LIMIT 1
Database: formula_1
Note: British Grand Prix is the name of race; British refers to the United Kindom;
Question: How many seasons has Silverstone Circuit hosted the United Kindom grand prix?
SQL: SELECT count(races.circuitid) FROM circuits INNER JOIN races ON races.circuitid = circuits.circuitid WHERE circuits.name = 'Silverstone Circuit' AND races.name = 'British Grand Prix'
Database: formula_1
Question: Name all drivers in the 2010 Singapore Grand Prix order by their position stands.
SQL: SELECT drivers.forename, drivers.surname FROM races INNER JOIN driverstandings ON driverstandings.raceid = races.raceid INNER JOIN drivers ON drivers.driverid = driverstandings.driverid WHERE races.name = 'Singapore Grand Prix' AND races.year = 2010 ORDER BY driverstandings.position ASC
Database: formula_1
Note: the most points scored refers to max(points); Full name of the driver refers to drivers.forename and drivers.surname;
Question: State the driver with the most points scored. Find his full name with that points.
SQL: SELECT drivers.forename, drivers.surname, driverstandings.points FROM races INNER JOIN driverstandings ON driverstandings.raceid = races.raceid INNER JOIN drivers ON drivers.driverid = driverstandings.driverid ORDER BY driverstandings.points DESC LIMIT 1
Database: formula_1
Question: Name the top 3 drivers and the points they scored in the 2017 Chinese Grand Prix.
SQL: SELECT drivers.forename, drivers.surname, driverstandings.points FROM races INNER JOIN driverstandings ON driverstandings.raceid = races.raceid INNER JOIN drivers ON drivers.driverid = driverstandings.driverid WHERE races.name = 'Chinese Grand Prix' AND races.year = 2017 ORDER BY driverstandings.points DESC LIMIT 3
Database: formula_1
Note: the best lap time refers to min(milliseconds); List the driver refers to drivers.forename and drivers.surname; List the race refers to races.name;
Question: What is the best lap time recorded? List the driver and race with such recorded lap time.
SQL: SELECT laptimes.milliseconds, drivers.forename, drivers.surname, races.name FROM drivers INNER JOIN laptimes ON drivers.driverid = laptimes.driverid INNER JOIN races ON laptimes.raceid = races.raceid ORDER BY laptimes.milliseconds ASC LIMIT 1
Database: formula_1
Note: average lap time = AVG(milliseconds); 'Lewis Hamilton' refers to the full name of the driver; Full name of the driver refers to drivers.forename and drivers.surname; 'Malaysian Grand Prix' refers to races.name = 'Malaysian Grand Prix';
Question: What is the average lap time for Lewis Hamilton in the 2009 Malaysian Grand Prix?
SQL: SELECT avg(laptimes.milliseconds) FROM races INNER JOIN laptimes ON laptimes.raceid = races.raceid INNER JOIN drivers ON drivers.driverid = laptimes.driverid WHERE drivers.forename = 'Lewis' AND drivers.surname = 'Hamilton' AND races.year = 2009 AND races.name = 'Malaysian Grand Prix'
Database: formula_1
Note: percentage = DIVIDE(COUNT(raceid) where surname = 'Hamilton' and position>1), (COUNT(raceid) where surname = 'Hamilton'); since 2010 refers to year >= 2010;
Question: Calculate the percentage whereby Hamilton was not at the 1st track of the the f1 circuit since 2010.
SQL: SELECT cast(count(CASE WHEN driverstandings.position <> 1 THEN driverstandings.position END) AS REAL) * 100 / count(driverstandings.driverstandingsid) FROM races INNER JOIN driverstandings ON driverstandings.raceid = races.raceid INNER JOIN drivers ON drivers.driverid = driverstandings.driverid WHERE drivers.surname = 'Hamilton' AND races.year >= 2010
Database: formula_1
Note: Full name of the driver refers to drivers.forename and drivers.surname; the most winning refers to MAX(COUNT(wins)); average point scores refers to MAX(points);
Question: Name the driver with the most winning. Mention his nationality and what is his maximum point scores.
SQL: SELECT drivers.forename, drivers.surname, drivers.nationality, max(driverstandings.points) FROM drivers INNER JOIN driverstandings ON driverstandings.driverid = drivers.driverid WHERE driverstandings.wins >= 1 GROUP BY drivers.forename, drivers.surname, drivers.nationality ORDER BY count(driverstandings.wins) DESC LIMIT 1
Database: formula_1
Note: date of birth refers to drivers.dob; The larger the birthday value, the younger the person is, and vice versa; Japanese refers to nationality = 'Japanese'; age = year(CURRENT_timeSTAMP) - year(dob);
Question: How old is the youngest Japanese driver? What is his name?
SQL: SELECT strftime('%Y', CURRENT_TIMESTAMP) - strftime('%Y', dob), forename , surname FROM drivers WHERE nationality = 'Japanese' ORDER BY dob DESC LIMIT 1
Database: formula_1
Note: from year 1990 to 2000 refers to year(date) between 1990 and 2000;
Question: List circuits which host 4 f1 races from year 1990 to 2000.
SQL: SELECT DISTINCT circuits.name FROM circuits INNER JOIN races ON races.circuitid = circuits.circuitid WHERE strftime('%Y', races.date) BETWEEN '1990' AND '2000' GROUP BY circuits.name HAVING count(races.raceid) = 4
Database: formula_1
Question: List circuits in USA which hosted f1 races in 2006. State the name and location of circuit and the name of the race it hosted.
SQL: SELECT circuits.name, circuits.location, races.name FROM circuits INNER JOIN races ON races.circuitid = circuits.circuitid WHERE circuits.country = 'USA' AND races.year = 2006
Database: formula_1
Note: in September 2005 refers to MONTH(date) = 9 and year(date) = 2005;
Question: Name the races along with its circuit name and location for f1 races hosted in September 2005.
SQL: SELECT DISTINCT races.name, circuits.name, circuits.location FROM circuits INNER JOIN races ON races.circuitid = circuits.circuitid WHERE races.year = 2005 AND strftime('%m', races.date) = '09'
Database: formula_1
Note: Alex Yoong refers to the full name of the driver; Full name of the driver refers to drivers.forename and drivers.surname;track number less than 10 refers to position < 20;
Question: Which race was Alex Yoong in when he was in track number less than 20?
SQL: SELECT races.name FROM races INNER JOIN driverstandings ON driverstandings.raceid = races.raceid INNER JOIN drivers ON drivers.driverid = driverstandings.driverid WHERE drivers.forename = 'Alex' AND drivers.surname = 'Yoong' AND driverstandings.position < 20
Database: formula_1
Note: win from races refers to max(points);
Question: How many times did Michael Schumacher won from races hosted in Sepang International Circuit?
SQL: SELECT sum(driverstandings.wins) FROM drivers INNER JOIN driverstandings ON driverstandings.driverid = drivers.driverid INNER JOIN races ON races.raceid = driverstandings.raceid INNER JOIN circuits ON circuits.circuitid = races.circuitid WHERE drivers.forename = 'Michael' AND drivers.surname = 'Schumacher' AND circuits.name = 'Sepang International Circuit'
Database: formula_1
Note: fastest lap refers to min(milliseconds); Alex Yoong refers to the full name of the driver; Full name of the driver refers to drivers.forename and drivers.surname;
Question: State the race and year of race in which Michael Schumacher had his fastest lap.
SQL: SELECT races.name, races.year FROM races INNER JOIN laptimes ON laptimes.raceid = races.raceid INNER JOIN drivers ON drivers.driverid = laptimes.driverid WHERE drivers.forename = 'Michael' AND drivers.surname = 'Schumacher' ORDER BY laptimes.milliseconds ASC LIMIT 1