question_id
int64 0
1.53k
| db_id
stringclasses 11
values | question
stringlengths 23
477
| evidence
stringlengths 0
482
| SQL
stringlengths 29
3.69k
| difficulty
stringclasses 3
values |
|---|---|---|---|---|---|
900
|
formula_1
|
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.
|
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
|
simple
|
|
901
|
formula_1
|
Name the races along with its circuit name and location for f1 races hosted in September 2005.
|
N/A
|
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'
|
simple
|
902
|
formula_1
|
Which race was Alex Yoong in when he was in track number less than 20?
|
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
|
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
|
simple
|
903
|
formula_1
|
How many times did Michael Schumacher won from races hosted in Sepang International Circuit?
|
win from races refers to max(points)
|
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'
|
moderate
|
904
|
formula_1
|
State the race and year of race in which Michael Schumacher had his fastest lap.
|
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;
|
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
|
moderate
|
905
|
formula_1
|
What is Eddie Irvine's average points scored in year 2000?
|
average points = AVG(points where year = 2000)
|
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
|
simple
|
906
|
formula_1
|
Which was Lewis Hamilton first race? What was his points recorded for his first race event?
|
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;
|
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
|
moderate
|
907
|
formula_1
|
List all races in 2017 and the hosting country order by date of the event.
|
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
|
simple
|
|
908
|
formula_1
|
What is the most laps f1 races had? Name the race, year and circuit location where the races with most laps was hosted.
|
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;
|
simple
|
|
909
|
formula_1
|
Among all European Grand Prix races, what is the percentage of the races were hosted in Germany?
|
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
|
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';
|
moderate
|
910
|
formula_1
|
What's the location coordinates of Silverstone Circuit?
|
location coordinates refers to (lat, lng); Silverstone Circuit refers to circuits.name = 'Silverstone Circuit'
|
SELECT lat, lng FROM circuits WHERE name = 'Silverstone Circuit'
|
simple
|
911
|
formula_1
|
Which of these circuits is located at a higher latitude, Silverstone Circuit, Hockenheimring or Hungaroring?
|
higher latitude refers to max(lat)
|
SELECT name FROM circuits WHERE name IN ('Silverstone Circuit', 'Hockenheimring', 'Hungaroring') ORDER BY lat DESC LIMIT 1
|
simple
|
912
|
formula_1
|
What's the reference name of Marina Bay Street Circuit?
|
reference name refers to circuitRef; Marina Bay Street Circuit refers to circuits.name = 'Marina Bay Street Circuit'
|
SELECT circuitRef FROM circuits WHERE name = 'Marina Bay Street Circuit'
|
simple
|
913
|
formula_1
|
In which country can I find the circuit with the highest latitude?
|
highest latitude refers to max(lat)
|
SELECT country FROM circuits ORDER BY lat DESC LIMIT 1
|
simple
|
914
|
formula_1
|
How many drivers don't have a code?
|
don't have a code refers to code is null
|
SELECT COUNT(driverId) - COUNT(CASE WHEN code IS NOT NULL THEN code END) FROM drivers
|
simple
|
915
|
formula_1
|
Which country is the oldest driver from?
|
date of birth refers to drivers.dob; The larger the birthday value, the younger the person is, and vice versa;
|
SELECT nationality FROM drivers WHERE dob IS NOT NULL ORDER BY dob ASC LIMIT 1
|
simple
|
916
|
formula_1
|
Please list the surnames of all the Italian drivers.
|
Italian refers to nationality = 'italian'
|
SELECT surname FROM drivers WHERE nationality = 'Italian'
|
simple
|
917
|
formula_1
|
Which website should I go to if I want to know more about Anthony Davidson?
|
website refers to url
|
SELECT url FROM drivers WHERE forename = 'Anthony' AND surname = 'Davidson'
|
simple
|
918
|
formula_1
|
What's Lewis Hamilton's reference name?
|
reference name refers to driverRef
|
SELECT driverRef FROM drivers WHERE forename = 'Lewis' AND surname = 'Hamilton'
|
simple
|
919
|
formula_1
|
Which circuit did the 2009 Spanish Grand Prix use?
|
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'
|
simple
|
|
920
|
formula_1
|
Please list all the years that Silverstone Circuit was used in a Formula_1 race.
|
SELECT DISTINCT T2.year FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T1.name = 'Silverstone Circuit'
|
simple
|
|
921
|
formula_1
|
Please give more information about the Formula_1 races that used the Silverstone Circuit.
|
more information refers to url
|
SELECT DISTINCT T1.url FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T1.name = 'Silverstone Circuit'
|
simple
|
922
|
formula_1
|
What time did the the 2010's Formula_1 race took place on the Abu Dhabi Circuit?
|
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'
|
simple
|
|
923
|
formula_1
|
How many Formula_1 races took place on the circuits in Italy?
|
SELECT COUNT(T2.circuitId) FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T1.country = 'Italy'
|
simple
|
|
924
|
formula_1
|
Please list the exact dates on which a Formula_1 race took place on the Barcelona-Catalunya circuit.
|
SELECT T2.date FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T1.name = 'Circuit de Barcelona-Catalunya'
|
simple
|
|
925
|
formula_1
|
Please give the link of the website that shows more information about the circuits the Spanish Grand Prix used in 2009.
|
link of the website refers to url
|
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'
|
simple
|
926
|
formula_1
|
What's the fastest lap time ever in a race for Lewis Hamilton?
|
fastest lap time ever refers to min(fastestLapTime); Lewis Hamilton refers to forename = 'Lewis' AND surname = 'Hamilton'
|
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
|
simple
|
927
|
formula_1
|
Which driver created the fastest lap speed in a Formula_1 race? Please give both his forename and surname.
|
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
|
simple
|
|
928
|
formula_1
|
Which driver ranked the first in the Canadian Grand Prix in 2007? Please give his reference name.
|
reference name refers to driverRef; Canadian Grand Prix refers to races.name = 'Canadian Grand Prix';
|
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
|
moderate
|
929
|
formula_1
|
Please list the Formula_1 races that Lewis Hamilton participated.
|
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'
|
simple
|
|
930
|
formula_1
|
In which Formula_1 race did Lewis Hamilton rank the highest?
|
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;
|
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' ) )
|
simple
|
931
|
formula_1
|
What was the fastest lap speed among all drivers in the 2009 Spanish Grand Prix?
|
the fastest lap speed among all refers to max(fastestLapSpeed); Spanish Grand Prix refers to races.name = 'Spanish Grand Prix';
|
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
|
moderate
|
932
|
formula_1
|
In which years did Lewis Hamilton participate in a Formula_1 race?
|
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'
|
simple
|
|
933
|
formula_1
|
What was Lewis Hamilton's final rank in the 2008 Chinese Grand Prix?
|
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';
|
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
|
moderate
|
934
|
formula_1
|
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.
|
the no. 4 grid formation refers to grid = 4
|
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
|
moderate
|
935
|
formula_1
|
How many drivers managed to finish the race in the 2008 Australian Grand Prix?
|
managed to finish the race refers to time is not null
|
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
|
simple
|
936
|
formula_1
|
Which was the fastest lap for Lewis Hamilton in the 2008 Australian Grand Prix?
|
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'
|
simple
|
|
937
|
formula_1
|
What's the finish time for the driver who ranked second in 2008's AustChineseralian Grand Prix?
|
finish time refers to time; Chinese Grand Prix refers to races.name = 'Chinese Grand Prix';
|
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
|
simple
|
938
|
formula_1
|
Who was the champion of 2008's Australian Grand Prix and where can I know more about him?
|
only champion's finished time is represented by 'HH:MM:SS.mmm'; where can I know more refers to url
|
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
|
moderate
|
939
|
formula_1
|
How many drivers from the UN participated in the 2008 Australian Grand Prix?
|
from the UN refers to nationality = 'British'
|
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'
|
moderate
|
940
|
formula_1
|
How many drivers finished the race in the 2008 Chinese Grand Prix?
|
COUNT(raceID) > 0 reveals that this driver participated in races;
|
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 )
|
moderate
|
941
|
formula_1
|
How many points did Lewis Hamilton get in total in all the Formula_1 races he participated?
|
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'
|
simple
|
|
942
|
formula_1
|
What is the average fastest lap time in seconds for Lewis Hamilton in all the Formula_1 races?
|
average fastest lap time = avg(fastestLapTime); The time is recorded on 'MM:SS.mmm'
|
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'
|
moderate
|
943
|
formula_1
|
What is the rate of drivers completing all the laps in the 2008 Australian Grand Prix?
|
completing all the laps refers to time is not null; rate = divide(COUNT(raceID where time is not null), COUNT(raceID))
|
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
|
moderate
|
944
|
formula_1
|
How much faster in percentage is the champion than the driver who finished the race last in the 2008 Australian Grand Prix?
|
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
|
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);
|
challenging
|
945
|
formula_1
|
How many circuits are there in Adelaide, Australia?
|
Adelaide is a location in Australia; country is Australia.
|
SELECT COUNT(circuitId) FROM circuits WHERE location = 'Adelaide' AND country = 'Australia'
|
simple
|
946
|
formula_1
|
Please list the location coordinates of the US circuits.
|
location coordinates refers to (lat, lng); the US refers to country = 'USA';
|
SELECT lat, lng FROM circuits WHERE country = 'USA'
|
simple
|
947
|
formula_1
|
How many British drivers were born after 1980?
|
[Remove Evidence]
|
SELECT COUNT(driverId) FROM drivers WHERE nationality = 'British' AND STRFTIME('%Y', dob) > '1980'
|
simple
|
948
|
formula_1
|
What are the maximum points of British constructors?
|
SELECT MAX(T1.points) FROM constructorStandings AS T1 INNER JOIN constructors AS T2 on T1.constructorId = T2.constructorId WHERE T2.nationality = 'British'
|
simple
|
|
949
|
formula_1
|
Which constructor has the highest point?
|
highest point refers to the sum of point from all races
|
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;
|
simple
|
950
|
formula_1
|
Please list the constructor names with 0 points at race 291.
|
race at 291 refers to raceID = 291;
|
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;
|
simple
|
951
|
formula_1
|
How many Japanese constructors have 0 points in 2 races?
|
2 races refers to COUNT(raceID) = 2; Japanese refers to constructors.nationality = 'Japanese';
|
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
|
simple
|
952
|
formula_1
|
Which constructors have been ranked 1?
|
SELECT DISTINCT T2.name FROM results AS T1 INNER JOIN constructors AS T2 on T1.constructorId = T2.constructorId WHERE T1.rank = 1
|
simple
|
|
953
|
formula_1
|
How many French constructors have a lap number of over 50?
|
lap numbers of over 50 refers to laps > 50;
|
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'
|
simple
|
954
|
formula_1
|
Please calculate the race completion percentage of Japanese drivers from 2007 to 2009.
|
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;
|
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
|
challenging
|
955
|
formula_1
|
What is the average time in seconds of champion for each year, before year 1975?
|
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;
|
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
|
challenging
|
956
|
formula_1
|
Which drivers born after 1975 have been ranked 2? Please give their forenames and surnames.
|
born after 1975 refers to year(dob) >1975;
|
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
|
simple
|
957
|
formula_1
|
How many Italian drivers haven't finished the race?
|
haven't finished the race refers to time is null;
|
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
|
simple
|
958
|
formula_1
|
Which driver has the fastest lap time? Please give their forenames and surnames.
|
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
|
moderate
|
|
959
|
formula_1
|
Across all 2009 races, what was the lap number on which the race winner set the fastest lap time?
|
Here, “champion” means the race winner; take the minimum of winners’ fastest lap times across 2009 and return that lap number.
|
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;
|
simple
|
960
|
formula_1
|
What is the average of fastest lap speed in the 2009 Spanish Grand Prix race?
|
Spanish Grand Prix is the name of race refers to name = 'Spanish Grand Prix'; average fastest lap speed refers to avg(fastestLapSpeed);
|
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'
|
moderate
|
961
|
formula_1
|
Which race has the shortest actual finishing time? Please give the name and year.
|
shortest actual finishing time refers to Min(milliseconds) except milliseconds = null;
|
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
|
simple
|
962
|
formula_1
|
From 2000 to 2005, what percentage of drivers who were born before 1985 and the lap numbers were over 50?
|
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;
|
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;
|
challenging
|
963
|
formula_1
|
How many French drivers who obtain the laptime less than 02:00.00?
|
lap time less than 02:00.00 refers to seconds < 120;
|
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;
|
moderate
|
964
|
formula_1
|
List out the code for drivers who have nationality in America.
|
nationality = 'American'
|
SELECT code
FROM drivers
WHERE Nationality = 'American';
|
simple
|
965
|
formula_1
|
List out the Id number of races which were hold in 2009.
|
SELECT raceId FROM races WHERE year = 2009
|
simple
|
|
966
|
formula_1
|
How many driver participated in race ID number 18?
|
SELECT COUNT(driverId) FROM driverStandings WHERE raceId = 18
|
simple
|
|
967
|
formula_1
|
State code numbers of top 3 youngest drivers. How many Netherlandic drivers among them?
|
Youngest drivers are those with the most recent birth dates; “Netherlandic” and “Dutch” refer to the same nationality.
|
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;
|
simple
|
968
|
formula_1
|
What is reference name of Robert Kubica?
|
reference name refers to driverRef;
|
SELECT driverRef FROM drivers WHERE forename = 'Robert' AND surname = 'Kubica'
|
simple
|
969
|
formula_1
|
How many British drivers who were born in 1980?
|
born in 1980 refers to year(dob) = 1980;
|
SELECT COUNT(driverId) FROM drivers WHERE nationality = 'British' AND STRFTIME('%Y', dob) = '1980'
|
simple
|
970
|
formula_1
|
List the top 3 German drivers who were born from 1980–1990 with the fastest lap time.
|
“Fastest lap time” is taken as the minimum lap time (in milliseconds) across a driver’s recorded laps.
|
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;
|
moderate
|
971
|
formula_1
|
Please state the reference name of the oldest German driver.
|
oldest refers to the driver with the minimum date of birth (dob)
|
SELECT driverRef FROM drivers WHERE nationality = 'German' ORDER BY dob ASC, driverId ASC LIMIT 1
|
simple
|
972
|
formula_1
|
Which drivers who were born in 1971 and has the fastest lap time on the race? Give id and code of these drivers.
|
born in 1971 refers to date of birth is 1971; has the fastest lap time refers to fastestLapTime has values
|
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
|
moderate
|
973
|
formula_1
|
List out top 10 Spanish drivers who were born before 1982 and have the latest lap time.
|
born before 1982 refers to year(dob) < 1982; latest lap time refers to Max(time);
|
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
|
moderate
|
974
|
formula_1
|
Which racing year has the overall fastest lap time recorded?
|
“Fastest lap time” means the shortest lap time recorded.
|
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;
|
simple
|
975
|
formula_1
|
Which year has the lowest speed of lap time?
|
lowest speed of lap time refers to Max(time);
|
SELECT T2.year
FROM lapTimes AS T1
INNER JOIN races AS T2 ON T1.raceId = T2.raceId
ORDER BY T1.time DESC
LIMIT 1;
|
simple
|
976
|
formula_1
|
List the driver's ID of the top five driver, by descending order, the fastest time during the first lap of the race.
|
fastest time refers to Min(time);
|
SELECT driverId FROM lapTimes WHERE lap = 1 ORDER BY time LIMIT 5
|
simple
|
977
|
formula_1
|
From race no. 50 to 100, how many finishers have been disqualified?
|
disqualified refers to statusID = 2, finisher refers to time! = null; race no. refers to raceId; raceId > 50 and raceId < 100;
|
SELECT SUM(IIF(time IS NOT NULL, 1, 0)) FROM results WHERE statusId = 2 AND raceID < 100 AND raceId > 50
|
simple
|
978
|
formula_1
|
List the circuits in Austria along with their location and coordinates.
|
Coordinates are latitude and longitude.
|
SELECT DISTINCT location, lat, lng
FROM circuits
WHERE country = 'Austria';
|
simple
|
979
|
formula_1
|
What race number has the most finishers?
|
finisher refers to time is not null;
|
SELECT raceId
FROM results
GROUP BY raceId
ORDER BY COUNT(time) DESC
LIMIT 1
|
simple
|
980
|
formula_1
|
List the reference name of the drivers who passed the second qualifying lap during race no. 23. Indicate their nationality and birthday.
|
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
|
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
|
moderate
|
981
|
formula_1
|
On what year did the youngest driver had his first qualifying race? Also state the name, date and time of the race.
|
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.
|
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
|
moderate
|
982
|
formula_1
|
How many American drivers have puncture status.
|
puncture status refers to status = Puncture;
|
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'
|
simple
|
983
|
formula_1
|
Which of the Italian constructor got the highest point to date? Give its introduction website?
|
introduction website refers to url; Italian is a nationality
|
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
|
simple
|
984
|
formula_1
|
What is the website of the constructor who tallied the most total wins.
|
introduction website refers to url;
|
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
|
simple
|
985
|
formula_1
|
Among the drivers who participated in the French Grand Prix, who has the slowest time in the 3rd lap.
|
slowest time refers to Max(time);
|
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;
|
simple
|
986
|
formula_1
|
In which race did the fastest 1st lap time was recorded? Please indicate the time in milliseconds.
|
fastest refers to Min(time);
|
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
|
simple
|
987
|
formula_1
|
What is the average fastest lap time of the top 10 drivers in the 2006 United States Grand Prix?
|
top 10 refers to rank <11; AVG(fastestLapTime);
|
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'
|
simple
|
988
|
formula_1
|
List down top 3 German drivers who has the shortest average pit stop duration and were born between 1980-1985.
|
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));
|
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
|
challenging
|
989
|
formula_1
|
Who is the champion of the Canadian Grand Prix in 2008? Indicate his finish time.
|
Only the time of the champion shows in the format of "hour: minutes: seconds.millionsecond";
|
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 '_:%:__.___'
|
moderate
|
990
|
formula_1
|
What is the constructor reference name of the champion in the 2009 Singapore Grand Prix? Please give its website.
|
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
|
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 '_:%:__.___'
|
challenging
|
991
|
formula_1
|
What is the full name and date of birth of Austrian drivers born between 1981 and 1991?
|
Full name refers to forname, surname; Date of birth refers to dob; year(dob) BETWEEN '1981' AND '1991'; Austrian is a nationality
|
SELECT forename, surname, dob FROM drivers WHERE nationality = 'Austrian' AND STRFTIME('%Y', dob) BETWEEN '1981' AND '1991'
|
simple
|
992
|
formula_1
|
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.
|
Full name refers to forename and surname; between 1971 and 1985 is inclusive.
|
SELECT forename, surname, url, dob FROM drivers WHERE nationality = 'German' AND STRFTIME('%Y', dob) BETWEEN '1971' AND '1985' ORDER BY dob DESC
|
moderate
|
993
|
formula_1
|
Where is the Hungaroring circuit located? Also, find the country and coordinates of this circuit.
|
coordinates expressed in latitude and longitude refers to (lat, lng)
|
SELECT location, country, lat, lng FROM circuits WHERE name = 'Hungaroring'
|
simple
|
994
|
formula_1
|
Which constructor scored most points from Monaco Grand Prix between 1980 and 2010? List the score, name and nationality of this team.
|
Monaco Grand Priz refers to the race; race in year between 1980 and 2010
|
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
|
challenging
|
995
|
formula_1
|
What is the average score of Lewis Hamilton among all the Turkish Grand Prix?
|
Average score = AVG(points)
|
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'
|
moderate
|
996
|
formula_1
|
What is the annual average number of races held during the first 10 years of the 21st century?
|
first 10 years of the 21st century should be '2000-01-01' till '2009-12-31'
|
SELECT CAST(COUNT(*) AS REAL) / 10 AS annual_average
FROM races
WHERE year BETWEEN 2000 AND 2009
AND year IS NOT NULL
|
simple
|
997
|
formula_1
|
Which citizenship do the vast majority of the drivers hold?
|
vast majority refers to the nationality with the highest number of drivers; citizenship and nationality are synonymous in this context.
|
SELECT nationality FROM drivers GROUP BY nationality ORDER BY COUNT(driverId) DESC LIMIT 1
|
simple
|
998
|
formula_1
|
In terms of number of points acquired, how many victories did the driver who ranked 91st acquired?
|
victories refer to wins; 91st refers to points
|
SELECT SUM(wins) FROM driverStandings WHERE points = 91
|
simple
|
999
|
formula_1
|
What is the name of the race in which a driver recorded the fastest lap time?
|
In racing, a faster lap is indicated by a shorter time duration to complete the lap.
|
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);
|
simple
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.