birdsql/bird_sql_dev_20251106 huggingface dataset:
Database: formula_1
Question: Show me the season page of year when the race No. 901 took place.
Evidence: the season page refers to url; race number refers to raceId;
SQL:
SELECT T2.url FROM races AS T1 INNER JOIN seasons AS T2 ON T2.year = T1.year WHERE T1.raceId = 901
Database: formula_1
Question: For the race happened in 2015/11/29, how many drivers did not finish the race?
Evidence: Drivers who did not finish the race have NULL values in the time field.
SQL:
SELECT COUNT(T2.driverId) FROM races AS T1 INNER JOIN results AS T2 ON T2.raceId = T1.raceId WHERE T1.date = '2015-11-29' AND T2.time IS NULL
Database: formula_1
Question: For all the drivers who finished the game in race No. 872, who is the youngest?
Evidence: race number refers to raceId; drivers who finished the race refers to drivers with a recorded completion time; youngest refers to the driver born most recently
SQL:
SELECT T1.forename, T1.surname FROM drivers AS T1 INNER JOIN results AS T2 ON T2.driverId = T1.driverId WHERE T2.raceId = 872 AND T2.time IS NOT NULL ORDER BY T1.dob DESC LIMIT 1
Database: formula_1
Question: Who was the driver that got the best lap time in the race No. 348? Give his full name.
Evidence: race number refers to raceId; the best lap time refers to MIN(time)
SQL:
SELECT T2.forename, T2.surname FROM lapTimes AS T1 INNER JOIN drivers AS T2 ON T2.driverId = T1.driverId WHERE T1.raceId = 348 ORDER BY T1.time ASC LIMIT 1
Database: formula_1
Question: For the driver who set the fastest lap speed, what is his nationality?
Evidence: the fastest lap speed refers to (MAX) fastestLapSpeed;
SQL:
SELECT T1.nationality
FROM drivers AS T1
INNER JOIN results AS T2 ON T2.driverId = T1.driverId
ORDER BY T2.fastestLapSpeed DESC
LIMIT 1;
Database: formula_1
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?
Evidence: "Paul di Resta" refers to drivers.forename = 'Paul' AND drivers.surname = 'di Resta'; "No. 853 race" = results.raceId = 853, "next race" = results.raceId = 854; "fastest lap speed" = results.fastestLapSpeed (text type, must convert to REAL for calculation), with "percent faster" formula: ((853-speed - 854-speed) * 100) / 853-speed.
SQL:
SELECT ((MAX(CASE WHEN T2.raceId = 853 THEN CAST(T2.fastestLapSpeed AS REAL) END) - MAX(CASE WHEN T2.raceId = 854 THEN CAST(T2.fastestLapSpeed AS REAL) END)) * 100) / MAX(CASE WHEN T2.raceId = 853 THEN CAST(T2.fastestLapSpeed AS REAL) END) AS faster_percentage FROM drivers AS T1 INNER JOIN results AS T2 ON T2.driverId = T1.driverId WHERE T1.forename = 'Paul' AND T1.surname = 'di Resta';
Database: formula_1
Question: For the drivers who took part in the race in 1983/7/16, what's their race completion rate?
Evidence: DIVIDE(COUNT(driverid when time has value ), (COUNT(driverid )) as percentage; in 1983/7/16 refers to when date = '1983-07-16'
SQL:
SELECT CAST(COUNT(CASE WHEN T2.time IS NOT NULL THEN T2.driverId END) AS REAL) * 100 / COUNT(T2.driverId) FROM races AS T1 INNER JOIN results AS T2 ON T2.raceId = T1.raceId WHERE T1.date = '1983-07-16'
Database: formula_1
Question: Which year was the first Singapore Grand Prix?
Evidence: the first race refers to race happened in the earliest year;
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
Question: List the names of all races that occurred in the earliest recorded year and month.
Evidence: earliest recorded year and month refers to year = year(min(date)) and month = month(min(date));
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
Question: State the name and date of the last round of race in year 1999.
Evidence: the last round refers to max(round);
SQL:
SELECT name, date FROM races WHERE year = 1999 ORDER BY round DESC LIMIT 1
Database: formula_1
Question: Which year has the most number of races?
Evidence: the most number of races refers to max(round);
SQL:
SELECT year FROM races GROUP BY year ORDER BY COUNT(round) DESC LIMIT 1
Database: formula_1
Question: Name the races in year 2017 that are not hosted in year 2000.
Evidence: not hosted means not in;
SQL:
SELECT name FROM races WHERE year = 2017 AND name NOT IN ( SELECT name FROM races WHERE year = 2000 )
Database: formula_1
Question: In which country was the first European Grand Prix hosted? Name the circuit and location.
Evidence: the first refers to min(year);
SQL:
SELECT T1.country, T1.location FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T2.name = 'European Grand Prix' ORDER BY T2.year ASC LIMIT 1
Database: formula_1
Question: When was the last f1 season whereby Brands Hatch hosted the British Grand Prix?
Evidence: the last refers to max(year);
SQL:
SELECT T2.date FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T1.name = 'Brands Hatch' AND T2.name = 'British Grand Prix' ORDER BY T2.year DESC LIMIT 1
Database: formula_1
Question: How many seasons has Silverstone Circuit hosted the United Kindom grand prix?
Evidence: British Grand Prix is the name of race; British refers to the United Kindom
SQL:
SELECT COUNT(DISTINCT T2.year) FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitId = T1.circuitId WHERE T1.name = 'Silverstone Circuit' AND T2.name = 'British Grand Prix';
Database: formula_1
Question: Name all drivers in the 2010 Singapore Grand Prix order by their position stands.
SQL:
SELECT T3.forename, T3.surname FROM races AS T1 INNER JOIN driverStandings AS T2 ON T2.raceId = T1.raceId INNER JOIN drivers AS T3 ON T3.driverId = T2.driverId WHERE T1.name = 'Singapore Grand Prix' AND T1.year = 2010 ORDER BY T2.position ASC
Database: formula_1
Question: State the driver with the most points scored. Find his full name with that points.
Evidence: the most points scored refers to max(points); Full name of the driver refers to drivers.forename and drivers.surname;
SQL:
SELECT T3.forename, T3.surname, T2.points FROM races AS T1 INNER JOIN driverStandings AS T2 ON T2.raceId = T1.raceId INNER JOIN drivers AS T3 ON T3.driverId = T2.driverId ORDER BY T2.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 T3.forename, T3.surname, T2.points FROM races AS T1 INNER JOIN driverStandings AS T2 ON T2.raceId = T1.raceId INNER JOIN drivers AS T3 ON T3.driverId = T2.driverId WHERE T1.name = 'Chinese Grand Prix' AND T1.year = 2017 ORDER BY T2.points DESC LIMIT 3
Database: formula_1
Question: What is the best lap time recorded? List the driver and race with such recorded lap time.
Evidence: 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
SQL:
SELECT T2.milliseconds, T1.forename, T1.surname, T3.name FROM drivers AS T1 INNER JOIN lapTimes AS T2 ON T1.driverId = T2.driverId INNER JOIN races AS T3 ON T2.raceId = T3.raceId ORDER BY T2.milliseconds ASC LIMIT 1
Database: formula_1
Question: What is the average lap time for Lewis Hamilton in the 2009 Malaysian Grand Prix?
Evidence: 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'
SQL:
SELECT AVG(T2.milliseconds) FROM races AS T1 INNER JOIN lapTimes AS T2 ON T2.raceId = T1.raceId INNER JOIN drivers AS T3 ON T3.driverId = T2.driverId WHERE T3.forename = 'Lewis' AND T3.surname = 'Hamilton' AND T1.year = 2009 AND T1.name = 'Malaysian Grand Prix'
Database: formula_1
Question: Calculate the percentage whereby Hamilton was not at the 1st track of the the f1 circuit since 2010.
Evidence: percentage = DIVIDE(COUNT(raceId) where surname = 'Hamilton' and position>1), (COUNT(raceId) where surname = 'Hamilton'); since 2010 refers to year >= 2010
SQL:
SELECT CAST(COUNT(CASE WHEN T2.position <> 1 THEN T2.position END) AS REAL) * 100 / COUNT(T2.driverStandingsId) FROM races AS T1 INNER JOIN driverStandings AS T2 ON T2.raceId = T1.raceId INNER JOIN drivers AS T3 ON T3.driverId = T2.driverId WHERE T3.surname = 'Hamilton' AND T1.year >= 2010
Database: formula_1
Question: Name the driver with the most winning. Mention his nationality and what is his maximum point scores.
Evidence: 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);
SQL:
SELECT T1.forename, T1.surname, T1.nationality, MAX(T2.points) FROM drivers AS T1 INNER JOIN driverStandings AS T2 ON T2.driverId = T1.driverId WHERE T2.wins >= 1 GROUP BY T1.forename, T1.surname, T1.nationality ORDER BY COUNT(T2.wins) DESC LIMIT 1
Database: formula_1
Question: How old is the youngest Japanese driver? What is his name?
Evidence: The youngest driver means the one with the most recent birth date;being Japanese refers to drivers whose nationality is Japanese; person’s age is determined by subtracting their birth year from the current year.
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
Question: List circuits which host 4 f1 races from year 1990 to 2000.
Evidence: from year 1990 to 2000 refers to year(date) between 1990 and 2000;
SQL:
SELECT DISTINCT T1.name FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE STRFTIME('%Y', T2.date) BETWEEN '1990' AND '2000' GROUP BY T1.name HAVING COUNT(T2.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 T1.name, T1.location, T2.name FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T1.country = 'USA' AND T2.year = 2006
Database: formula_1
Question: Name the races along with its circuit name and location for f1 races hosted in September 2005.
Evidence: N/A
SQL:
SELECT DISTINCT T2.name, T1.name, T1.location FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T2.year = 2005 AND STRFTIME('%m', T2.date) = '09'
Database: formula_1
Question: Which race was Alex Yoong in when he was in track number less than 20?
Evidence: 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
SQL:
SELECT T1.name FROM races AS T1 INNER JOIN driverStandings AS T2 ON T2.raceId = T1.raceId INNER JOIN drivers AS T3 ON T3.driverId = T2.driverId WHERE T3.forename = 'Alex' AND T3.surname = 'Yoong' AND T2.position < 20
Database: formula_1
Question: How many times did Michael Schumacher won from races hosted in Sepang International Circuit?
Evidence: win from races refers to max(points)
SQL:
SELECT SUM(T2.wins) FROM drivers AS T1 INNER JOIN driverStandings AS T2 ON T2.driverId = T1.driverId INNER JOIN races AS T3 ON T3.raceId = T2.raceId INNER JOIN circuits AS T4 ON T4.circuitId = T3.circuitId WHERE T1.forename = 'Michael' AND T1.surname = 'Schumacher' AND T4.name = 'Sepang International Circuit'
Database: formula_1
Question: State the race and year of race in which Michael Schumacher had his fastest lap.
Evidence: fastest lap refers to min(milliseconds); Michael Schumacher refers to the full name of the driver; Full name of the driver refers to drivers.forename and drivers.surname;
SQL:
SELECT T1.name, T1.year FROM races AS T1 INNER JOIN lapTimes AS T2 ON T2.raceId = T1.raceId INNER JOIN drivers AS T3 ON T3.driverId = T2.driverId WHERE T3.forename = 'Michael' AND T3.surname = 'Schumacher' ORDER BY T2.milliseconds ASC LIMIT 1
Database: formula_1
Question: What is Eddie Irvine's average points scored in year 2000?
Evidence: average points = AVG(points where year = 2000)
SQL:
SELECT AVG(T2.points) FROM drivers AS T1 INNER JOIN driverStandings AS T2 ON T2.driverId = T1.driverId INNER JOIN races AS T3 ON T3.raceId = T2.raceId WHERE T1.forename = 'Eddie' AND T1.surname = 'Irvine' AND T3.year = 2000
Database: formula_1
Question: Which was Lewis Hamilton first race? What was his points recorded for his first race event?
Evidence: first race refers to min(Year); Lewis Hamiltonrefers to the full name of the driver; Full name of the driver refers to drivers.forename and drivers.surname;
SQL:
SELECT T1.name, T2.points FROM races AS T1 INNER JOIN driverStandings AS T2 ON T2.raceId = T1.raceId INNER JOIN drivers AS T3 ON T3.driverId = T2.driverId WHERE T3.forename = 'Lewis' AND T3.surname = 'Hamilton' ORDER BY T1.year ASC LIMIT 1
Database: formula_1
Question: List all races in 2017 and the hosting country order by date of the event.
SQL:
SELECT DISTINCT T2.name, T1.country FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T2.year = 2017 ORDER BY T2.date ASC
Database: formula_1
Question: What is the most laps f1 races had? Name the race, year and circuit location where the races with most laps was hosted.
SQL:
SELECT T2.name, T2.year, T1.location, MAX(T3.lap) AS max_laps
FROM circuits AS T1 
INNER JOIN races AS T2 ON T1.circuitId = T2.circuitId 
INNER JOIN lapTimes AS T3 ON T3.raceId = T2.raceId 
GROUP BY T2.raceId, T2.name, T2.year, T1.location
ORDER BY max_laps DESC, T2.raceId ASC
LIMIT 1;
Database: formula_1
Question: Among all European Grand Prix races, what is the percentage of the races were hosted in Germany?
Evidence: European Grand Prix races refers to races.name = 'European Grand Prix'; "hosted in Germany" refers to circuits.country = 'Germany' (circuits table links to races via circuitId); percentage = (COUNT(DISTINCT races.raceId where circuits.country = 'Germany' and races.name = 'European Grand Prix') ÷ COUNT(DISTINCT races.raceId where races.name = 'European Grand Prix')) × 100
SQL:
SELECT CAST(COUNT(DISTINCT CASE WHEN T1.country = 'Germany' THEN T2.raceId END) AS REAL) * 100 / COUNT(DISTINCT T2.raceId) FROM circuits T1 INNER JOIN races T2 ON T2.circuitId = T1.circuitId WHERE T2.name = 'European Grand Prix';
Database: formula_1
Question: What's the location coordinates of Silverstone Circuit?
Evidence: location coordinates refers to (lat, lng); Silverstone Circuit refers to circuits.name = 'Silverstone Circuit'
SQL:
SELECT lat, lng FROM circuits WHERE name = 'Silverstone Circuit'
Database: formula_1
Question: Which of these circuits is located at a higher latitude, Silverstone Circuit, Hockenheimring or Hungaroring?
Evidence: higher latitude refers to max(lat)
SQL:
SELECT name FROM circuits WHERE name IN ('Silverstone Circuit', 'Hockenheimring', 'Hungaroring') ORDER BY lat DESC LIMIT 1
Database: formula_1
Question: What's the reference name of Marina Bay Street Circuit?
Evidence: reference name refers to circuitRef; Marina Bay Street Circuit refers to circuits.name = 'Marina Bay Street Circuit'
SQL:
SELECT circuitRef FROM circuits WHERE name = 'Marina Bay Street Circuit'
Database: formula_1
Question: In which country can I find the circuit with the highest latitude?
Evidence: highest latitude refers to max(lat)
SQL:
SELECT country FROM circuits ORDER BY lat DESC LIMIT 1
Database: formula_1
Question: How many drivers don't have a code?
Evidence: don't have a code refers to code is null
SQL:
SELECT COUNT(driverId) - COUNT(CASE WHEN code IS NOT NULL THEN code END) FROM drivers
Database: formula_1
Question: Which country is the oldest driver from?
Evidence: date of birth refers to drivers.dob; The larger the birthday value, the younger the person is, and vice versa;
SQL:
SELECT nationality FROM drivers WHERE dob IS NOT NULL ORDER BY dob ASC LIMIT 1
Database: formula_1
Question: Please list the surnames of all the Italian drivers.
Evidence: Italian refers to nationality = 'italian'
SQL:
SELECT surname FROM drivers WHERE nationality = 'Italian'
Database: formula_1
Question: Which website should I go to if I want to know more about Anthony Davidson?
Evidence: website refers to url
SQL:
SELECT url FROM drivers WHERE forename = 'Anthony' AND surname = 'Davidson'
Database: formula_1
Question: What's Lewis Hamilton's reference name?
Evidence: reference name refers to driverRef
SQL:
SELECT driverRef FROM drivers WHERE forename = 'Lewis' AND surname = 'Hamilton'
Database: formula_1
Question: Which circuit did the 2009 Spanish Grand Prix use?
SQL:
SELECT T1.name FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T2.year = 2009 AND T2.name = 'Spanish Grand Prix'
Database: formula_1
Question: Please list all the years that Silverstone Circuit was used in a Formula_1 race.
SQL:
SELECT DISTINCT T2.year FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T1.name = 'Silverstone Circuit'
Database: formula_1
Question: Please give more information about the Formula_1 races that used the Silverstone Circuit.
Evidence: more information refers to url
SQL:
SELECT DISTINCT T1.url FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T1.name = 'Silverstone Circuit'
Database: formula_1
Question: What time did the the 2010's Formula_1 race took place on the Abu Dhabi Circuit?
SQL:
SELECT T2.date, T2.time FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T2.year = 2010 AND T2.name = 'Abu Dhabi Grand Prix'
Database: formula_1
Question: How many Formula_1 races took place on the circuits in Italy?
SQL:
SELECT COUNT(T2.circuitId) FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T1.country = 'Italy'
Database: formula_1
Question: Please list the exact dates on which a Formula_1 race took place on the Barcelona-Catalunya circuit.
SQL:
SELECT T2.date FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T1.name = 'Circuit de Barcelona-Catalunya'
Database: formula_1
Question: Please give the link of the website that shows more information about the circuits the Spanish Grand Prix used in 2009.
Evidence: link of the website refers to url
SQL:
SELECT T1.url FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T2.year = 2009 AND T2.name = 'Spanish Grand Prix'
Database: formula_1
Question: What's the fastest lap time ever in a race for Lewis Hamilton?
Evidence: fastest lap time ever refers to min(fastestLapTime); Lewis Hamilton refers to forename = 'Lewis' AND surname = 'Hamilton'
SQL:
SELECT MIN(T2.fastestLapTime) FROM drivers AS T1 INNER JOIN results AS T2 ON T2.driverId = T1.driverId WHERE T1.forename = 'Lewis' AND T1.surname = 'Hamilton' AND T2.fastestLapTime IS NOT NULL
Database: formula_1
Question: Which driver created the fastest lap speed in a Formula_1 race? Please give both his forename and surname.
SQL:
SELECT T1.forename, T1.surname FROM drivers AS T1 INNER JOIN results AS T2 ON T2.driverId = T1.driverId WHERE T2.fastestLapTime IS NOT NULL ORDER BY T2.fastestLapSpeed DESC LIMIT 1
Database: formula_1
Question: Which driver ranked the first in the Canadian Grand Prix in 2007? Please give his reference name.
Evidence: reference name refers to driverRef; Canadian Grand Prix refers to races.name = 'Canadian Grand Prix';
SQL:
SELECT T3.driverRef FROM races AS T1 INNER JOIN results AS T2 ON T2.raceId = T1.raceId INNER JOIN drivers AS T3 ON T3.driverId = T2.driverId WHERE T1.name = 'Canadian Grand Prix' AND T2.position = 1 AND T1.year = 2007
Database: formula_1
Question: Please list the Formula_1 races that Lewis Hamilton participated.
SQL:
SELECT T1.name FROM races AS T1 INNER JOIN results AS T2 ON T2.raceId = T1.raceId INNER JOIN drivers AS T3 ON T3.driverId = T2.driverId WHERE T3.forename = 'Lewis' AND T3.surname = 'Hamilton'
Database: formula_1
Question: In which Formula_1 race did Lewis Hamilton rank the highest?
Evidence: rank the highest refers to min(rank); Lewis Hamilton refers to the full name of the driver; Full name of the driver refers to drivers.forename and drivers.surname;
SQL:
SELECT name FROM races WHERE raceId IN ( SELECT raceId FROM results WHERE rank = 1 AND driverId = ( SELECT driverId FROM drivers WHERE forename = 'Lewis' AND surname = 'Hamilton' ) )
Database: formula_1
Question: What was the fastest lap speed among all drivers in the 2009 Spanish Grand Prix?
Evidence: the fastest lap speed among all refers to max(fastestLapSpeed); Spanish Grand Prix refers to races.name = 'Spanish Grand Prix';
SQL:
SELECT T2.fastestLapSpeed FROM races AS T1 INNER JOIN results AS T2 ON T2.raceId = T1.raceId WHERE T1.name = 'Spanish Grand Prix' AND T1.year = 2009 AND T2.fastestLapSpeed IS NOT NULL ORDER BY T2.fastestLapSpeed DESC LIMIT 1
Database: formula_1
Question: In which years did Lewis Hamilton participate in a Formula_1 race?
SQL:
SELECT DISTINCT T1.year FROM races AS T1 INNER JOIN results AS T2 ON T2.raceId = T1.raceId INNER JOIN drivers AS T3 ON T3.driverId = T2.driverId WHERE T3.forename = 'Lewis' AND T3.surname = 'Hamilton'
Database: formula_1
Question: What was Lewis Hamilton's final rank in the 2008 Chinese Grand Prix?
Evidence: Lewis Hamilton refers to the full name of the driver; Full name of the driver refers to drivers.forename and drivers.surname; final rank refers to positionOrder; Chinese Grand Prix refers to races.name = 'Chinese Grand Prix';
SQL:
SELECT T2.positionOrder FROM races AS T1 INNER JOIN results AS T2 ON T2.raceId = T1.raceId INNER JOIN drivers AS T3 ON T3.driverId = T2.driverId WHERE T3.forename = 'Lewis' AND T3.surname = 'Hamilton' AND T1.name = 'Chinese Grand Prix' AND T1.year = 2008
Database: formula_1
Question: Which driver was in the no. 4 grid formation when starting the race in 1989's Australian Grand Prix? Please give his forename and surname.
Evidence: the no. 4 grid formation refers to grid = 4
SQL:
SELECT T3.forename, T3.surname FROM races AS T1 INNER JOIN results AS T2 ON T2.raceId = T1.raceId INNER JOIN drivers AS T3 ON T3.driverId = T2.driverId WHERE T2.grid = 4 AND T1.name = 'Australian Grand Prix' AND T1.year = 1989
Database: formula_1
Question: How many drivers managed to finish the race in the 2008 Australian Grand Prix?
Evidence: managed to finish the race refers to time is not null
SQL:
SELECT COUNT(T2.driverId) FROM races AS T1 INNER JOIN results AS T2 ON T2.raceId = T1.raceId WHERE T1.name = 'Australian Grand Prix' AND T1.year = 2008 AND T2.time IS NOT NULL
Database: formula_1
Question: Which was the fastest lap for Lewis Hamilton in the 2008 Australian Grand Prix?
SQL:
SELECT T1.fastestLap FROM results AS T1 INNER JOIN races AS T2 on T1.raceId = T2.raceId INNER JOIN drivers AS T3 on T1.driverId = T3.driverId WHERE T2.name = 'Australian Grand Prix' AND T2.year = 2008 AND T3.forename = 'Lewis' AND T3.surname = 'Hamilton'
Database: formula_1
Question: What's the finish time for the driver who ranked second in 2008's AustChineseralian Grand Prix?
Evidence: finish time refers to time; Chinese Grand Prix refers to races.name = 'Chinese Grand Prix';
SQL:
SELECT T1.time FROM results AS T1 INNER JOIN races AS T2 on T1.raceId = T2.raceId WHERE T1.rank = 2 AND T2.name = 'Chinese Grand Prix' AND T2.year = 2008
Database: formula_1
Question: Who was the champion of 2008's Australian Grand Prix and where can I know more about him?
Evidence: only champion's finished time is represented by 'HH:MM:SS.mmm'; where can I know more refers to url
SQL:
SELECT T1.forename, T1.surname, T1.url FROM drivers AS T1 INNER JOIN results AS T2 ON T1.driverId = T2.driverId INNER JOIN races AS T3 ON T3.raceId = T2.raceId WHERE T3.name = 'Australian Grand Prix' AND T2.time LIKE '_:%:__.___' AND T3.year = 2008
Database: formula_1
Question: How many drivers from the UN participated in the 2008 Australian Grand Prix?
Evidence: from the UN refers to nationality = 'British'
SQL:
SELECT COUNT(DISTINCT T1.driverId)
FROM drivers AS T1
INNER JOIN results AS T2 ON T1.driverId = T2.driverId
INNER JOIN races AS T3 ON T3.raceId = T2.raceId
WHERE T3.name = 'Australian Grand Prix'
  AND T3.year = 2008
  AND T1.nationality = 'British'
Database: formula_1
Question: How many drivers finished the race in the 2008 Chinese Grand Prix?
Evidence: COUNT(raceID) > 0 reveals that this driver participated in races;
SQL:
SELECT COUNT(*) FROM ( SELECT T1.driverId FROM results AS T1 INNER JOIN races AS T2 on T1.raceId = T2.raceId WHERE T2.name = 'Chinese Grand Prix' AND T2.year = 2008 AND T1.time IS NOT NULL GROUP BY T1.driverId )
Database: formula_1
Question: How many points did Lewis Hamilton get in total in all the Formula_1 races he participated?
SQL:
SELECT SUM(T2.points) FROM drivers AS T1 INNER JOIN results AS T2 ON T1.driverId = T2.driverId WHERE T1.forename = 'Lewis' AND T1.surname = 'Hamilton'
Database: formula_1
Question: What is the average fastest lap time in seconds for Lewis Hamilton in all the Formula_1 races?
Evidence: average fastest lap time = avg(fastestLapTime); The time is recorded on 'MM:SS.mmm'
SQL:
SELECT AVG(CAST(SUBSTR(T2.fastestLapTime, 1, INSTR(T2.fastestLapTime, ':') - 1) AS INTEGER) * 60 + CAST(SUBSTR(T2.fastestLapTime, INSTR(T2.fastestLapTime, ':') + 1) AS REAL)) FROM drivers AS T1 INNER JOIN results AS T2 ON T1.driverId = T2.driverId WHERE T1.surname = 'Hamilton' AND T1.forename = 'Lewis'
Database: formula_1
Question: What is the rate of drivers completing all the laps in the 2008 Australian Grand Prix?
Evidence: completing all the laps refers to time is not null; rate = divide(COUNT(raceID where time is not null), COUNT(raceID))
SQL:
SELECT CAST(SUM(IIF(T1.time IS NOT NULL, 1, 0)) AS REAL) * 100 / COUNT(T1.resultId) FROM results AS T1 INNER JOIN races AS T2 ON T1.raceId = T2.raceId WHERE T2.name = 'Australian Grand Prix' AND T2.year = 2008
Database: formula_1
Question: How much faster in percentage is the champion than the driver who finished the race last in the 2008 Australian Grand Prix?
Evidence: how much faster in percentage = divide(subtract(incremental time, champion time), last_driver time) * 100; last driver finished time = incremental time + champion time; only champion's finished time is represented by 'HH:MM:SS.mmm'; finished the game refers to time is not null
SQL:
WITH time_in_seconds AS (
  SELECT T1.positionOrder,
         CASE WHEN T1.positionOrder = 1
              THEN (CAST(SUBSTR(T1.time, 1, 1) AS REAL) * 3600) + (CAST(SUBSTR(T1.time, 3, 2) AS REAL) * 60) + CAST(SUBSTR(T1.time, 6) AS REAL)
              ELSE CAST(SUBSTR(T1.time, 2) AS REAL)
         END AS time_seconds
  FROM results AS T1
  INNER JOIN races AS T2 ON T1.raceId = T2.raceId
  WHERE T2.name = 'Australian Grand Prix' AND T1.time IS NOT NULL AND T2.year = 2008
),
champion_time AS (
  SELECT time_seconds FROM time_in_seconds WHERE positionOrder = 1
),
last_driver_incremental AS (
  SELECT time_seconds FROM time_in_seconds WHERE positionOrder = (SELECT MAX(positionOrder) FROM time_in_seconds)
)
SELECT (CAST((SELECT time_seconds FROM last_driver_incremental) AS REAL) * 100) /
       (SELECT time_seconds + (SELECT time_seconds FROM last_driver_incremental) FROM champion_time);
Database: formula_1
Question: How many circuits are there in Adelaide, Australia?
Evidence: Adelaide is a location in Australia; country is Australia.
SQL:
SELECT COUNT(circuitId) FROM circuits WHERE location = 'Adelaide' AND country = 'Australia'
Database: formula_1
Question: Please list the location coordinates of the US circuits.
Evidence: location coordinates refers to (lat, lng); the US refers to country = 'USA';
SQL:
SELECT lat, lng FROM circuits WHERE country = 'USA'
Database: formula_1
Question: How many British drivers were born after 1980?
Evidence: [Remove Evidence]
SQL:
SELECT COUNT(driverId) FROM drivers WHERE nationality = 'British' AND STRFTIME('%Y', dob) > '1980'
Database: formula_1
Question: What are the maximum points of British constructors?
SQL:
SELECT MAX(T1.points) FROM constructorStandings AS T1 INNER JOIN constructors AS T2 on T1.constructorId = T2.constructorId WHERE T2.nationality = 'British'
Database: formula_1
Question: Which constructor has the highest point?
Evidence: highest point refers to the sum of point from all races
SQL:
SELECT T2.name FROM constructorStandings AS T1 INNER JOIN constructors AS T2 ON T1.constructorId = T2.constructorId GROUP BY T2.name ORDER BY SUM(T1.points) DESC LIMIT 1;
Database: formula_1
Question: Please list the constructor names with 0 points at race 291.
Evidence: race at 291 refers to raceID = 291;
SQL:
SELECT T2.name
FROM constructorStandings AS T1
INNER JOIN constructors AS T2 ON T1.constructorId = T2.constructorId
WHERE T1.points = 0 AND T1.raceId = 291;
Database: formula_1
Question: How many Japanese constructors have 0 points in 2 races?
Evidence: 2 races refers to COUNT(raceID) = 2; Japanese refers to constructors.nationality = 'Japanese';
SQL:
SELECT COUNT(T1.raceId) FROM constructorStandings AS T1 INNER JOIN constructors AS T2 on T1.constructorId = T2.constructorId WHERE T1.points = 0 AND T2.nationality = 'Japanese' GROUP BY T1.constructorId HAVING COUNT(raceId) = 2
Database: formula_1
Question: Which constructors have been ranked 1?
SQL:
SELECT DISTINCT T2.name FROM results AS T1 INNER JOIN constructors AS T2 on T1.constructorId = T2.constructorId WHERE T1.rank = 1
Database: formula_1
Question: How many French constructors have a lap number of over 50?
Evidence: lap numbers of over 50 refers to laps > 50;
SQL:
SELECT COUNT(DISTINCT T2.constructorId) FROM results AS T1 INNER JOIN constructors AS T2 on T1.constructorId = T2.constructorId WHERE T1.laps > 50 AND T2.nationality = 'French'
Database: formula_1
Question: Please calculate the race completion percentage of Japanese drivers from 2007 to 2009.
Evidence: from 2007 to 2009 refers to year between 2007 and 2009; race completion refers to time is not null; percentage = Divide(COUNT(DriverID where time is not null and year between 2007 and 2009),Count (DriverID where year between 2007 and 2009))*100; 
SQL:
SELECT CAST(SUM(IIF(T1.time IS NOT NULL, 1, 0)) AS REAL) * 100 / COUNT(T1.raceId) FROM results AS T1 INNER JOIN races AS T2 on T1.raceId = T2.raceId INNER JOIN drivers AS T3 on T1.driverId = T3.driverId WHERE T3.nationality = 'Japanese' AND T2.year BETWEEN 2007 AND 2009
Database: formula_1
Question: What is the average time in seconds of champion for each year, before year 1975?
Evidence: only champion's finished time is represented by 'HH:MM:SS.mmm'; finished the game refers to time is not null; before year 1975 refers to year < 1975;
SQL:
WITH champion_times AS ( SELECT T2.year, CASE WHEN INSTR(T1.time, ':') = 2 THEN CAST(SUBSTR(T1.time, 1, 1) AS REAL) * 3600 + CAST(SUBSTR(T1.time, 3, 2) AS REAL) * 60 + CAST(SUBSTR(T1.time, 6, 2) AS REAL) + CAST(SUBSTR(T1.time, 9) AS REAL) / 1000 WHEN INSTR(T1.time, ':') = 3 THEN CAST(SUBSTR(T1.time, 1, 2) AS REAL) * 3600 + CAST(SUBSTR(T1.time, 4, 2) AS REAL) * 60 + CAST(SUBSTR(T1.time, 7, 2) AS REAL) + CAST(SUBSTR(T1.time, 10) AS REAL) / 1000 END AS time_seconds FROM results AS T1 INNER JOIN races AS T2 ON T1.raceId = T2.raceId WHERE T1.positionOrder = 1 AND T1.time IS NOT NULL AND T2.year < 1975 ) SELECT year, AVG(time_seconds) FROM champion_times GROUP BY year HAVING AVG(time_seconds) IS NOT NULL
Database: formula_1
Question: Which drivers born after 1975 have been ranked 2? Please give their forenames and surnames.
Evidence: born after 1975 refers to year(dob) >1975;
SQL:
SELECT T2.forename, T2.surname FROM results AS T1 INNER JOIN drivers AS T2 on T1.driverId = T2.driverId WHERE STRFTIME('%Y', T2.dob) > '1975' AND T1.rank = 2
Database: formula_1
Question: How many Italian drivers haven't finished the race?
Evidence: haven't finished the race refers to time is null;
SQL:
SELECT COUNT(DISTINCT T1.driverId) FROM results AS T1 INNER JOIN drivers AS T2 on T1.driverId = T2.driverId WHERE T2.nationality = 'Italian' AND T1.time IS NULL
Database: formula_1
Question: Which driver has the fastest lap time? Please give their forenames and surnames.
SQL:
SELECT T2.forename, T2.surname, T1.fastestLapTime FROM results AS T1 INNER JOIN drivers AS T2 on T1.driverId = T2.driverId WHERE T1.fastestLapTime IS NOT NULL ORDER BY T1.fastestLapTime ASC, T2.surname DESC LIMIT 1
Database: formula_1
Question: Across all 2009 races, what was the lap number on which the race winner set the fastest lap time?
Evidence: Here, “champion” means the race winner; take the minimum of winners’ fastest lap times across 2009 and return that lap number.
SQL:
SELECT T1.fastestLap
FROM results AS T1
JOIN races AS T2 ON T1.raceId = T2.raceId
WHERE T2.year = 2009
  AND T1.positionOrder = 1
  AND T1.fastestLapTime IS NOT NULL
ORDER BY T1.fastestLapTime ASC, T1.raceId ASC
LIMIT 1;
Database: formula_1
Question: What is the average of fastest lap speed in the 2009 Spanish Grand Prix race?
Evidence: Spanish Grand Prix is the name of race refers to name = 'Spanish Grand Prix'; average fastest lap speed refers to avg(fastestLapSpeed);
SQL:
SELECT AVG(T1.fastestLapSpeed) FROM results AS T1 INNER JOIN races AS T2 on T1.raceId = T2.raceId WHERE T2.year = 2009 AND T2.name = 'Spanish Grand Prix'
Database: formula_1
Question: Which race has the shortest actual finishing time? Please give the name and year.
Evidence: shortest actual finishing time refers to Min(milliseconds) except milliseconds = null;
SQL:
SELECT T1.name, T1.year FROM races AS T1 INNER JOIN results AS T2 on T1.raceId = T2.raceId WHERE T2.milliseconds IS NOT NULL ORDER BY T2.milliseconds LIMIT 1
Database: formula_1
Question: From 2000 to 2005, what percentage of drivers who were born before 1985 and the lap numbers were over 50?
Evidence: born before 1985 refers to year(dob)<1985; in 2000 to 2005 refers to year between 2000 and 2005; percentage = Divide(COUNT(driverId where year (dob) <1985 and laps >50),COUNT(DriverID where year between 2000 and 2005) *100;
SQL:
SELECT CAST(SUM(IIF(STRFTIME('%Y', T3.dob) < '1985' AND T1.laps > 50, 1, 0)) AS REAL) * 100 / COUNT(*)
FROM results AS T1
INNER JOIN races AS T2 ON T1.raceId = T2.raceId
INNER JOIN drivers AS T3 ON T1.driverId = T3.driverId
WHERE T2.year BETWEEN 2000 AND 2005;
Database: formula_1
Question: How many French drivers who obtain the laptime less than 02:00.00?
Evidence: lap time less than 02:00.00 refers to seconds < 120;
SQL:
SELECT COUNT(DISTINCT T1.driverId)
FROM drivers AS T1
INNER JOIN lapTimes AS T2 ON T1.driverId = T2.driverId
WHERE T1.nationality = 'French'
  AND (CAST(SUBSTR(T2.time, 1, 2) AS INTEGER) * 60 + CAST(SUBSTR(T2.time, 4, 2) AS INTEGER) + CAST(SUBSTR(T2.time, 7, 2) AS REAL) / 1000) < 120;
Database: formula_1
Question: List out the code for drivers who have nationality in America.
Evidence: nationality = 'American'
SQL:
SELECT code
FROM drivers
WHERE Nationality = 'American';
Database: formula_1
Question: List out the Id number of races which were hold in 2009.
SQL:
SELECT raceId FROM races WHERE year = 2009
Database: formula_1
Question: How many driver participated in race ID number 18?
SQL:
SELECT COUNT(driverId) FROM driverStandings WHERE raceId = 18
Database: formula_1
Question: State code numbers of top 3 youngest drivers. How many Netherlandic drivers among them?
Evidence: Youngest drivers are those with the most recent birth dates; “Netherlandic” and “Dutch” refer to the same nationality.
SQL:
WITH top3 AS (
  SELECT code, nationality
  FROM drivers
  ORDER BY JULIANDAY(dob) DESC
  LIMIT 3
)
SELECT t.code,
       (SELECT COUNT(*) FROM top3 WHERE nationality = 'Dutch') AS dutch_count
FROM top3 AS t
ORDER BY t.code;
Database: formula_1
Question: What is reference name of Robert Kubica?
Evidence: reference name refers to driverRef;
SQL:
SELECT driverRef FROM drivers WHERE forename = 'Robert' AND surname = 'Kubica'
Database: formula_1
Question: How many British drivers who were born in 1980?
Evidence: born in 1980 refers to year(dob) = 1980;
SQL:
SELECT COUNT(driverId) FROM drivers WHERE nationality = 'British' AND STRFTIME('%Y', dob) = '1980'
Database: formula_1
Question: List the top 3 German drivers who were born from 1980–1990 with the fastest lap time.
Evidence: “Fastest lap time” is taken as the minimum lap time (in milliseconds) across a driver’s recorded laps.
SQL:
SELECT d.driverId,
       (d.forename || ' ' || d.surname) AS driver_name,
       MIN(lt.milliseconds) AS best_lap_ms
FROM drivers AS d
JOIN lapTimes AS lt ON lt.driverId = d.driverId
WHERE d.nationality = 'German'
  AND STRFTIME('%Y', d.dob) BETWEEN '1980' AND '1990'
  AND lt.milliseconds IS NOT NULL
GROUP BY d.driverId, driver_name
ORDER BY best_lap_ms ASC, driver_name ASC
LIMIT 3;
Database: formula_1
Question: Please state the reference name of the oldest German driver.
Evidence: oldest refers to the driver with the minimum date of birth (dob)
SQL:
SELECT driverRef FROM drivers WHERE nationality = 'German' ORDER BY dob ASC, driverId ASC LIMIT 1
Database: formula_1
Question: Which drivers who were born in 1971 and has the fastest lap time on the race? Give id and code of these drivers.
Evidence: born in 1971 refers to date of birth is 1971; has the fastest lap time refers to fastestLapTime has values
SQL:
SELECT DISTINCT T2.driverId, T2.code FROM results AS T1 INNER JOIN drivers AS T2 on T1.driverId = T2.driverId WHERE STRFTIME('%Y', T2.dob) = '1971' AND T1.fastestLapTime IS NOT NULL
Database: formula_1
Question: List out top 10 Spanish drivers who were born before 1982 and have the latest lap time.
Evidence: born before 1982 refers to year(dob) < 1982; latest lap time refers to Max(time);
SQL:
SELECT T2.driverId FROM pitStops AS T1 INNER JOIN drivers AS T2 on T1.driverId = T2.driverId WHERE T2.nationality = 'Spanish' AND STRFTIME('%Y', T2.dob) < '1982' ORDER BY T1.time DESC LIMIT 10
Database: formula_1
Question: Which racing year has the overall fastest lap time recorded?
Evidence: “Fastest lap time” means the shortest lap time recorded.
SQL:
WITH times AS (
  SELECT r.year,
         res.fastestLapTime,
         (CAST(SUBSTR(res.fastestLapTime, 1, INSTR(res.fastestLapTime, ':') - 1) AS REAL) * 60)
         + CAST(SUBSTR(res.fastestLapTime, INSTR(res.fastestLapTime, ':') + 1,
                        INSTR(res.fastestLapTime, '.') - INSTR(res.fastestLapTime, ':') - 1) AS REAL)
         + CAST(SUBSTR(res.fastestLapTime, INSTR(res.fastestLapTime, '.') + 1) AS REAL) / 1000.0 AS secs
  FROM results AS res
  JOIN races AS r ON res.raceId = r.raceId
  WHERE res.fastestLapTime IS NOT NULL
)
SELECT year
FROM times
ORDER BY secs ASC, year ASC
LIMIT 1;
Database: formula_1
Question: Which year has the lowest speed of lap time?
Evidence: lowest speed of lap time refers to Max(time);
SQL:
SELECT T2.year
FROM lapTimes AS T1
INNER JOIN races AS T2 ON T1.raceId = T2.raceId
ORDER BY T1.time DESC
LIMIT 1;
Database: formula_1
Question: List the driver's ID of the top five driver, by descending order, the fastest time during the first lap of the race.
Evidence: fastest time refers to Min(time);
SQL:
SELECT driverId FROM lapTimes WHERE lap = 1 ORDER BY time LIMIT 5
Database: formula_1
Question: From race no. 50 to 100, how many finishers have been disqualified?
Evidence: disqualified refers to statusID = 2, finisher refers to time! = null; race no. refers to raceId; raceId > 50 and raceId < 100;
SQL:
SELECT SUM(IIF(time IS NOT NULL, 1, 0)) FROM results WHERE statusId = 2 AND raceID < 100 AND raceId > 50
Database: formula_1
Question: List the circuits in Austria along with their location and coordinates.
Evidence: Coordinates are latitude and longitude.
SQL:
SELECT DISTINCT location, lat, lng
FROM circuits
WHERE country = 'Austria';
Database: formula_1
Question: What race number has the most finishers?
Evidence: finisher refers to time is not null;
SQL:
SELECT raceId 
FROM results 
GROUP BY raceId 
ORDER BY COUNT(time) DESC 
LIMIT 1
Database: formula_1
Question: List the reference name of the drivers who passed the second qualifying lap during race no. 23. Indicate their nationality and birthday.
Evidence: birthday refers to dob; reference name of drivers refers to driverRef; race no. refers to raceId; passed the second qualifying lap means the driver completed q2
SQL:
SELECT T2.driverRef, T2.nationality, T2.dob FROM qualifying AS T1 INNER JOIN drivers AS T2 on T1.driverId = T2.driverId WHERE T1.raceId = 23 AND T1.q2 IS NOT NULL
Database: formula_1
Question: On what year did the youngest driver had his first qualifying race? Also state the name, date and time of the race.
Evidence: The youngest driver is the one with the latest date of birth. The first qualifying race is the earliest race by date for that driver.
SQL:
SELECT T3.year, T3.name, T3.date, T3.time 
FROM qualifying AS T1 
INNER JOIN drivers AS T2 ON T1.driverId = T2.driverId 
INNER JOIN races AS T3 ON T1.raceId = T3.raceId 
WHERE T1.driverId = ( 
    SELECT driverId 
    FROM drivers 
    ORDER BY dob DESC, driverId ASC 
    LIMIT 1 
) 
ORDER BY T3.date ASC, T3.raceId ASC 
LIMIT 1
Database: formula_1
Question: How many American drivers have puncture status.
Evidence: puncture status refers to status = Puncture;
SQL:
SELECT COUNT(T1.driverId) FROM drivers AS T1 INNER JOIN results AS T2 on T1.driverId = T2.driverId INNER JOIN status AS T3 on T2.statusId = T3.statusId WHERE T3.status = 'Puncture' AND T1.nationality = 'American'
Database: formula_1
Question: Which of the Italian constructor got the highest point to date? Give its introduction website?
Evidence: introduction website refers to url; Italian is a nationality
SQL:
SELECT T1.url FROM constructors AS T1 INNER JOIN constructorStandings AS T2 on T1.constructorId = T2.constructorId WHERE T1.nationality = 'Italian' ORDER BY T2.points DESC LIMIT 1
Database: formula_1
Question: What is the website of the constructor who tallied the most total wins.
Evidence: introduction website refers to url;
SQL:
SELECT T1.url FROM constructors AS T1 INNER JOIN constructorStandings AS T2 on T1.constructorId = T2.constructorId ORDER BY T2.wins DESC, T2.constructorId ASC LIMIT 1
Database: formula_1
Question: Among the drivers who participated in the French Grand Prix, who has the slowest time in the 3rd lap.
Evidence: slowest time refers to Max(time);
SQL:
SELECT T1.driverId
FROM lapTimes AS T1
INNER JOIN races AS T2 ON T1.raceId = T2.raceId
WHERE T2.name = 'French Grand Prix' AND T1.lap = 3
ORDER BY T1.time DESC
LIMIT 1;
Database: formula_1
Question: In which race did the fastest 1st lap time was recorded? Please indicate the time in milliseconds.
Evidence: fastest refers to Min(time);
SQL:
SELECT T1.milliseconds FROM lapTimes AS T1 INNER JOIN races AS T2 on T1.raceId = T2.raceId WHERE T1.lap = 1 ORDER BY T1.time LIMIT 1
Database: formula_1
Question: What is the average fastest lap time of the top 10 drivers in the 2006 United States Grand Prix?
Evidence: top 10 refers to rank <11; AVG(fastestLapTime);
SQL:
SELECT AVG(T1.fastestLapTime) FROM results AS T1 INNER JOIN races AS T2 on T1.raceId = T2.raceId WHERE T1.rank < 11 AND T2.year = 2006 AND T2.name = 'United States Grand Prix'
Database: formula_1
Question: List down top 3 German drivers who has the shortest average pit stop duration and were born between 1980-1985.
Evidence: Full name of the driver refers to drivers.forename and drivers.surname; born between 1980-1985 refers to 1980 <= year(dob) <= 1985; Average pitstop duration refers to Divide(SUM(duration),COUNT(duration)); shortest average refers to Min(avg(duration));
SQL:
SELECT T2.forename, T2.surname FROM pitStops AS T1 INNER JOIN drivers AS T2 on T1.driverId = T2.driverId WHERE T2.nationality = 'German' AND CAST(STRFTIME('%Y', T2.dob) AS INTEGER) BETWEEN 1980 AND 1985 GROUP BY T2.driverId, T2.forename, T2.surname ORDER BY AVG(T1.milliseconds) LIMIT 3
Database: formula_1
Question: Who is the champion of the Canadian Grand Prix in 2008? Indicate his finish time.
Evidence: Only the time of the champion shows in the format of "hour: minutes: seconds.millionsecond";
SQL:
SELECT T1.time FROM results AS T1 INNER JOIN races AS T2 ON T1.raceId = T2.raceId WHERE T2.name = 'Canadian Grand Prix' AND T2.year = 2008 AND T1.time LIKE '_:%:__.___'
Database: formula_1
Question: What is the constructor reference name of the champion in the 2009 Singapore Grand Prix? Please give its website.
Evidence: the time of the champion shows in the format of "minutes: seconds.millionsecond" in which Max(time); constructor reference name refers to constructorRef; website refers to url
SQL:
SELECT T3.constructorRef, T3.url FROM results AS T1 INNER JOIN races AS T2 on T1.raceId = T2.raceId INNER JOIN constructors AS T3 on T1.constructorId = T3.constructorId WHERE T2.name = 'Singapore Grand Prix' AND T2.year = 2009 AND T1.time LIKE '_:%:__.___'
Database: formula_1
Question: What is the full name and date of birth of Austrian drivers born between 1981 and 1991?
Evidence: Full name refers to forname, surname; Date of birth refers to dob; year(dob) BETWEEN '1981' AND '1991'; Austrian is a nationality
SQL:
SELECT forename, surname, dob FROM drivers WHERE nationality = 'Austrian' AND STRFTIME('%Y', dob) BETWEEN '1981' AND '1991'
Database: formula_1
Question: Find the full name, Wiki Pedia page link, and date of birth of German drivers born between 1971 and 1985. List it in descending order of date of birth.
Evidence: Full name refers to forename and surname; between 1971 and 1985 is inclusive.
SQL:
SELECT forename, surname, url, dob FROM drivers WHERE nationality = 'German' AND STRFTIME('%Y', dob) BETWEEN '1971' AND '1985' ORDER BY dob DESC
Database: formula_1
Question: Where is the Hungaroring circuit located? Also, find the country and coordinates of this circuit.
Evidence: coordinates expressed in latitude and longitude refers to (lat, lng)
SQL:
SELECT location, country, lat, lng FROM circuits WHERE name = 'Hungaroring'
Database: formula_1
Question: Which constructor scored most points from Monaco Grand Prix between 1980 and 2010? List the score, name and nationality of this team.
Evidence: Monaco Grand Priz refers to the race; race in year between 1980 and 2010
SQL:
SELECT SUM(T1.points), T2.name, T2.nationality FROM constructorResults AS T1 INNER JOIN constructors AS T2 ON T1.constructorId = T2.constructorId INNER JOIN races AS T3 ON T3.raceid = T1.raceid WHERE T3.name = 'Monaco Grand Prix' AND T3.year BETWEEN 1980 AND 2010 GROUP BY T2.name ORDER BY SUM(T1.points) DESC LIMIT 1
Database: formula_1
Question: What is the average score of Lewis Hamilton among all the Turkish Grand Prix?
Evidence: Average score = AVG(points)
SQL:
SELECT AVG(T2.points) FROM drivers AS T1 INNER JOIN driverStandings AS T2 ON T1.driverId = T2.driverId INNER JOIN races AS T3 ON T3.raceId = T2.raceId WHERE T1.forename = 'Lewis' AND T1.surname = 'Hamilton' AND T3.name = 'Turkish Grand Prix'
Database: formula_1
Question: What is the annual average number of races held during the first 10 years of the 21st century?
Evidence: first 10 years of the 21st century should be '2000-01-01' till '2009-12-31'
SQL:
SELECT CAST(COUNT(*) AS REAL) / 10 AS annual_average 
FROM races 
WHERE year BETWEEN 2000 AND 2009 
AND year IS NOT NULL
Database: formula_1
Question: Which citizenship do the vast majority of the drivers hold?
Evidence: vast majority refers to the nationality with the highest number of drivers; citizenship and nationality are synonymous in this context.
SQL:
SELECT nationality FROM drivers GROUP BY nationality ORDER BY COUNT(driverId) DESC LIMIT 1
Database: formula_1
Question: In terms of number of points acquired, how many victories did the driver who ranked 91st acquired?
Evidence: victories refer to wins; 91st refers to points


SQL:
SELECT SUM(wins) FROM driverStandings WHERE points = 91
Database: formula_1
Question: What is the name of the race in which a driver recorded the fastest lap time?
Evidence: In racing, a faster lap is indicated by a shorter time duration to complete the lap.
SQL:
SELECT T1.name FROM races AS T1 INNER JOIN results AS T2 ON T1.raceId = T2.raceId WHERE T2.fastestLapTime = (SELECT MIN(fastestLapTime) FROM results WHERE fastestLapTime IS NOT NULL);
Database: formula_1
Question: Which racetrack hosted the most recent race? Indicate the full location.
Evidence: Full location includes both city/location and country; the most recent race is the one with the latest date.
SQL:
SELECT (c.location || ', ' || c.country) AS full_location
FROM circuits AS c
INNER JOIN races AS r ON c.circuitId = r.circuitId
ORDER BY r.date DESC, r.raceId DESC
LIMIT 1;