Dludora/Bird-minidev-sqlserver-oracle huggingface dataset:
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 (SQLite): 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
SQL (SQL Server): 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
SQL (Oracle): SELECT T2.positionOrder FROM races T1 INNER JOIN results T2 ON T2.raceId = T1.raceId INNER JOIN drivers T3 ON T3.driverId = T2.driverId WHERE T3.forename = 'Lewis' AND T3.surname = 'Hamilton' AND T1.name = 'Chinese Grand Prix' AND T1.year = 2008

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 (SQLite): 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
SQL (SQL Server): 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
SQL (Oracle): SELECT T1."TIME" FROM results T1 INNER JOIN races T2 on T1.raceId = T2.raceId WHERE T1.rank = 2 AND T2.name = 'Chinese Grand Prix' AND T2.year = 2008

Question: Among the drivers that finished the race in the 2008 Chinese Grand Prix, how many of them have participated in Formula_1 races?
Evidence: COUNT(raceID) > 0 reveals that this driver participated in races; drivers who finished the race refers to time has value.
SQL (SQLite): 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 HAVING COUNT(T2.raceId) > 0 )
SQL (SQL Server): SELECT COUNT(*) AS _agg1 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 HAVING COUNT(T2.raceId) > 0 ) _t1
SQL (Oracle): SELECT COUNT(*) FROM ( SELECT T1.driverId FROM results T1 INNER JOIN races 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 HAVING COUNT(T2.raceId) > 0 )
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 (SQLite): 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)
SQL (SQL Server): WITH time_in_seconds AS ( SELECT T1.positionOrder, CASE WHEN T1.positionOrder = 1 THEN (TRY_CAST(SUBSTRING(T1.time, 1, 1) AS FLOAT) * 3600) + (TRY_CAST(SUBSTRING(T1.time, 3, 2) AS FLOAT) * 60) + TRY_CAST(SUBSTRING(T1.time, 6, LEN(T1.time)) AS FLOAT) ELSE TRY_CAST(SUBSTRING(T1.time, 2, LEN(T1.time)) AS FLOAT) 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) AS _agg1 FROM time_in_seconds) ) SELECT (TRY_CAST((SELECT time_seconds FROM last_driver_incremental) AS FLOAT) * 100) / (SELECT time_seconds + (SELECT time_seconds FROM last_driver_incremental) FROM champion_time)
SQL (Oracle): WITH time_in_seconds AS ( SELECT T1.positionOrder, CASE WHEN T1.positionOrder = 1 THEN (CAST(SUBSTR(T1."TIME", 1, 1) AS BINARY_DOUBLE) * 3600) + (CAST(SUBSTR(T1."TIME", 3, 2) AS BINARY_DOUBLE) * 60) + CAST(SUBSTR(T1."TIME", 6) AS BINARY_DOUBLE) ELSE CAST(SUBSTR(T1."TIME", 2) AS BINARY_DOUBLE) END AS time_seconds FROM results T1 INNER JOIN races 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 BINARY_DOUBLE) * 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: Australia is the country; Melbourne is the location of circuit;
SQL (SQLite): SELECT COUNT(circuitId) FROM circuits WHERE location = 'Adelaide' AND country = 'Australia'
SQL (SQL Server): SELECT COUNT(circuitId) AS _agg1 FROM circuits WHERE location = 'Adelaide' AND country = 'Australia'
SQL (Oracle): SELECT COUNT(circuitId) FROM circuits WHERE location = 'Adelaide' AND country = 'Australia'

Question: What are the maximum points of British constructors?
Evidence: maximum points = MAX(points); British is a nationality
SQL (SQLite): SELECT MAX(T1.points) FROM constructorStandings AS T1 INNER JOIN constructors AS T2 on T1.constructorId = T2.constructorId WHERE T2.nationality = 'British'
SQL (SQL Server): SELECT MAX(T1.points) AS _agg1 FROM constructorStandings AS T1 INNER JOIN constructors AS T2 on T1.constructorId = T2.constructorId WHERE T2.nationality = 'British'
SQL (Oracle): SELECT MAX(T1.points) FROM constructorStandings T1 INNER JOIN constructors T2 on T1.constructorId = T2.constructorId WHERE T2.nationality = 'British'

Question: Please list the constructor names with 0 points at race 291.
Evidence: race at 291 refers to raceID = 291;
SQL (SQLite): 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
SQL (SQL Server): 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
SQL (Oracle): SELECT T2.name FROM constructorStandings T1 INNER JOIN constructors T2 on T1.constructorId = T2.constructorId WHERE T1.points = 0 AND T1.raceId = 291

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 (SQLite): 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
SQL (SQL Server): SELECT COUNT(T1.raceId) AS _agg1 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
SQL (Oracle): SELECT COUNT(T1.raceId) FROM constructorStandings T1 INNER JOIN constructors 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: 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 (SQLite): 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
SQL (SQL Server): SELECT TRY_CAST(SUM(IIF(T1.time IS NOT NULL, TRY_CAST(1 AS FLOAT), 0.0)) AS FLOAT) * 100 / COUNT(T1.raceId) AS _agg1 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
SQL (Oracle): SELECT CAST(SUM(CASE WHEN T1."TIME" IS NOT NULL THEN CAST(1 AS BINARY_DOUBLE) ELSE 0.0 END) AS BINARY_DOUBLE) * 100 / COUNT(T1.raceId) FROM results T1 INNER JOIN races T2 on T1.raceId = T2.raceId INNER JOIN drivers 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 (SQLite): WITH time_in_seconds AS ( SELECT T2.year, T2.raceId, 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,2) AS REAL )   + CAST(SUBSTR(T1.time, 9) AS REAL)/1000 ELSE 0 END AS time_seconds FROM results AS T1 INNER JOIN races AS T2 ON T1.raceId = T2.raceId WHERE T1.time IS NOT NULL ), champion_time AS ( SELECT year, raceId, time_seconds FROM time_in_seconds WHERE positionOrder = 1 ) SELECT year, AVG(time_seconds) FROM champion_time WHERE year < 1975 GROUP BY year HAVING AVG(time_seconds) IS NOT NULL
SQL (SQL Server): WITH time_in_seconds AS ( SELECT T2.year, T2.raceId, T1.positionOrder, CASE WHEN T1.positionOrder = 1 THEN (TRY_CAST(SUBSTRING(T1.time, 1, 1) AS FLOAT) * 3600) + (TRY_CAST(SUBSTRING(T1.time, 3, 2) AS FLOAT) * 60) + TRY_CAST(SUBSTRING(T1.time, 6,2) AS FLOAT)   + TRY_CAST(SUBSTRING(T1.time, 9, LEN(T1.time)) AS FLOAT)/1000 ELSE 0 END AS time_seconds FROM results AS T1 INNER JOIN races AS T2 ON T1.raceId = T2.raceId WHERE T1.time IS NOT NULL ), champion_time AS ( SELECT year, raceId, time_seconds FROM time_in_seconds WHERE positionOrder = 1 ) SELECT year, AVG(TRY_CAST(time_seconds AS FLOAT)) AS _agg1 FROM champion_time WHERE year < 1975 GROUP BY year HAVING AVG(TRY_CAST(time_seconds AS FLOAT)) IS NOT NULL
SQL (Oracle): WITH time_in_seconds AS ( SELECT T2.year, T2.raceId, T1.positionOrder, CASE WHEN T1.positionOrder = 1 THEN (CAST(SUBSTR(T1."TIME", 1, 1) AS BINARY_DOUBLE) * 3600) + (CAST(SUBSTR(T1."TIME", 3, 2) AS BINARY_DOUBLE) * 60) + CAST(SUBSTR(T1."TIME", 6,2) AS BINARY_DOUBLE )   + CAST(SUBSTR(T1."TIME", 9) AS BINARY_DOUBLE)/1000 ELSE 0 END AS time_seconds FROM results T1 INNER JOIN races T2 ON T1.raceId = T2.raceId WHERE T1."TIME" IS NOT NULL ), champion_time AS ( SELECT year, raceId, time_seconds FROM time_in_seconds WHERE positionOrder = 1 ) SELECT year, AVG(time_seconds) FROM champion_time WHERE year < 1975 GROUP BY year HAVING AVG(time_seconds) IS NOT NULL

Question: What is the fastest lap number of the champion in 2009?
Evidence: in 2009 refers to year = 2009; Only the time of the champion shows in the format of "hour: minutes: seconds.millionsecond"
SQL (SQLite): SELECT T1.fastestLap FROM results AS T1 INNER JOIN races AS T2 on T1.raceId = T2.raceId WHERE T2.year = 2009 AND T1.time LIKE '_:%:__.___'
SQL (SQL Server): SELECT T1.fastestLap FROM results AS T1 INNER JOIN races AS T2 on T1.raceId = T2.raceId WHERE T2.year = 2009 AND T1.time LIKE '_:%:__.___'
SQL (Oracle): SELECT T1.fastestLap FROM results T1 INNER JOIN races T2 on T1.raceId = T2.raceId WHERE T2.year = 2009 AND T1."TIME" LIKE '_:%:__.___'
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 (SQLite): 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'
SQL (SQL Server): SELECT AVG(TRY_CAST(T1.fastestLapSpeed AS FLOAT)) AS _agg1 FROM results AS T1 INNER JOIN races AS T2 on T1.raceId = T2.raceId WHERE T2.year = 2009 AND T2.name = 'Spanish Grand Prix'
SQL (Oracle): SELECT AVG(T1.fastestLapSpeed) FROM results T1 INNER JOIN races T2 on T1.raceId = T2.raceId WHERE T2.year = 2009 AND T2.name = 'Spanish Grand Prix'

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 (SQLite): 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
SQL (SQL Server): SELECT TRY_CAST(SUM(IIF(YEAR(T3.dob) < '1985' AND T1.laps > 50, 1, 0)) AS FLOAT) * 100 / COUNT(*) AS _agg1 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
SQL (Oracle): SELECT CAST(SUM(CASE WHEN SUBSTR(T3.dob, 1, 4) < '1985' AND T1.laps > 50 THEN CAST(1 AS BINARY_DOUBLE) ELSE 0.0 END) AS BINARY_DOUBLE) * 100 / COUNT(*) FROM results T1 INNER JOIN races T2 on T1.raceId = T2.raceId INNER JOIN drivers T3 on T1.driverId = T3.driverId WHERE T2.year BETWEEN 2000 AND 2005

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 (SQLite): SELECT COUNT(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
SQL (SQL Server): SELECT COUNT(T1.driverId) AS _agg1 FROM drivers AS T1 INNER JOIN lapTimes AS T2 on T1.driverId = T2.driverId WHERE T1.nationality = 'French' AND (TRY_CAST(SUBSTRING(T2.time, 1, 2) AS FLOAT) * 60 + TRY_CAST(SUBSTRING(T2.time, 4, 2) AS FLOAT) + TRY_CAST(SUBSTRING(T2.time, 7, 2) AS FLOAT) / 1000) < 120
SQL (Oracle): SELECT COUNT(T1.driverId) FROM drivers T1 INNER JOIN lapTimes T2 on T1.driverId = T2.driverId WHERE T1.nationality = 'French' AND (TO_NUMBER(NULLIF(REGEXP_REPLACE(SUBSTR(T2."TIME", 1, 2), '[^0-9.-]', ''), '')) * 60 + TO_NUMBER(NULLIF(REGEXP_REPLACE(SUBSTR(T2."TIME", 4, 2), '[^0-9.-]', ''), '')) + TO_NUMBER(NULLIF(REGEXP_REPLACE(SUBSTR(T2."TIME", 7, 2), '[^0-9.-]', ''), '')) / 1000) < 120
Database: formula_1

Question: List out the code for drivers who have nationality in American.
Evidence: nationality = 'American'
SQL (SQLite): SELECT code FROM drivers WHERE Nationality = 'American'
SQL (SQL Server): SELECT code FROM drivers WHERE Nationality = 'American'
SQL (Oracle): SELECT code FROM drivers WHERE Nationality = 'American'

Question: State code numbers of top 3 yougest drivers. How many Netherlandic drivers among them?
Evidence: youngest driver refers to Max (year(dob)); Netherlandic and Dutch refer to the same country
SQL (SQLite): SELECT COUNT(*) FROM ( SELECT T1.nationality FROM drivers AS T1 ORDER BY JULIANDAY(T1.dob) DESC LIMIT 3) AS T3 WHERE T3.nationality = 'Dutch'
SQL (SQL Server): SELECT COUNT(*) AS _agg1 FROM ( SELECT T1.nationality FROM drivers AS T1 ORDER BY TRY_CONVERT(DATE, T1.dob) DESC OFFSET 0 ROWS FETCH NEXT 3 ROWS ONLY) AS T3 WHERE T3.nationality = 'Dutch'
SQL (Oracle): SELECT COUNT(*) FROM ( SELECT T1.nationality FROM drivers T1 ORDER BY TO_DATE(T1.dob, 'YYYY-MM-DD') DESC NULLS LAST FETCH FIRST 3 ROWS ONLY) T3 WHERE T3.nationality = 'Dutch'

Question: Please state the reference name of the oldest German driver.
Evidence: oldest refers to MIN(year(dob)); reference names appear in drverRef.
SQL (SQLite): SELECT driverRef FROM drivers WHERE nationality = 'German' ORDER BY JULIANDAY(dob) ASC LIMIT 1
SQL (SQL Server): SELECT driverRef FROM drivers WHERE nationality = 'German' ORDER BY TRY_CONVERT(DATE, dob) ASC OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY
SQL (Oracle): SELECT driverRef FROM drivers WHERE nationality = 'German' ORDER BY TO_DATE(dob, 'YYYY-MM-DD') ASC NULLS FIRST FETCH FIRST 1 ROWS ONLY

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 year(dob) = 1971; has the fastest lap time refers to fastestLapTime has values
SQL (SQLite): SELECT 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
SQL (SQL Server): SELECT T2.driverId, T2.code FROM results AS T1 INNER JOIN drivers AS T2 on T1.driverId = T2.driverId WHERE YEAR(T2.dob) = '1971' AND T1.fastestLapTime IS NOT NULL
SQL (Oracle): SELECT T2.driverId, T2.code FROM results T1 INNER JOIN drivers T2 on T1.driverId = T2.driverId WHERE SUBSTR(T2.dob, 1, 4) = '1971' AND T1.fastestLapTime IS NOT NULL

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 (SQLite): SELECT SUM(IIF(time IS NOT NULL, 1, 0)) FROM results WHERE statusId = 2 AND raceID < 100 AND raceId > 50
SQL (SQL Server): SELECT SUM(IIF(time IS NOT NULL, TRY_CAST(1 AS FLOAT), 0.0)) AS _agg1 FROM results WHERE statusId = 2 AND raceID < 100 AND raceId > 50
SQL (Oracle): SELECT SUM(CASE WHEN "TIME" IS NOT NULL THEN CAST(1 AS BINARY_DOUBLE) ELSE 0.0 END) FROM results WHERE statusId = 2 AND raceID < 100 AND raceId > 50
Database: formula_1

Question: How many times the circuits were held in Austria? Please give their location and coordinates.
Evidence: location coordinates refers to (lat,lng); Austria refers to country = 'Austria';
SQL (SQLite): SELECT DISTINCT location, lat, lng FROM circuits WHERE country = 'Austria'
SQL (SQL Server): SELECT DISTINCT location, lat, lng FROM circuits WHERE country = 'Austria'
SQL (Oracle): SELECT DISTINCT location, lat, lng FROM circuits WHERE country = 'Austria'

Question: On what year did the youngest driver had his first qualifying race? Also state the name, date and time of the race.
Evidence: date of birth refers to drivers.dob; The larger the birthday value, the younger the person is, and vice versa; first qualifying race refers to MIN(races.date);
SQL (SQLite): 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 LIMIT 1 ) ORDER BY T3.date ASC LIMIT 1
SQL (SQL Server): 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 TOP 1 driverId FROM drivers ORDER BY dob DESC ) ORDER BY T3.date ASC OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY
SQL (Oracle): SELECT T3.year, T3.name, T3."DATE", T3."TIME" FROM qualifying T1 INNER JOIN drivers T2 on T1.driverId = T2.driverId INNER JOIN races T3 on T1.raceId = T3.raceId WHERE T1.driverId = ( SELECT driverId FROM drivers ORDER BY dob DESC NULLS LAST FETCH FIRST 1 ROWS ONLY ) ORDER BY T3."DATE" ASC NULLS FIRST FETCH FIRST 1 ROWS ONLY

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 (SQLite): SELECT T2.forename, T2.surname FROM pitStops AS T1 INNER JOIN drivers AS T2 on T1.driverId = T2.driverId WHERE T2.nationality = 'German' AND STRFTIME('%Y', T2.dob) BETWEEN '1980' AND '1985' GROUP BY T2.forename, T2.surname ORDER BY AVG(T1.duration) LIMIT 3
SQL (SQL Server): SELECT T2.forename, T2.surname FROM pitStops AS T1 INNER JOIN drivers AS T2 on T1.driverId = T2.driverId WHERE T2.nationality = 'German' AND YEAR(T2.dob) BETWEEN '1980' AND '1985' GROUP BY T2.forename, T2.surname ORDER BY AVG(TRY_CAST(T1.duration AS FLOAT)) OFFSET 0 ROWS FETCH NEXT 3 ROWS ONLY
SQL (Oracle): SELECT T2.forename, T2.surname FROM pitStops T1 INNER JOIN drivers T2 on T1.driverId = T2.driverId WHERE T2.nationality = 'German' AND SUBSTR(T2.dob, 1, 4) BETWEEN '1980' AND '1985' GROUP BY T2.forename, T2.surname ORDER BY AVG(TO_NUMBER(NULLIF(REGEXP_SUBSTR(T1.duration, '-?[0-9]+(?:\.[0-9]+)?'), ''))) NULLS FIRST FETCH FIRST 3 ROWS ONLY
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 (SQLite): 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 '_:%:__.___'
SQL (SQL Server): 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 '_:%:__.___'
SQL (Oracle): SELECT T1."TIME" FROM results T1 INNER JOIN races T2 ON T1.raceId = T2.raceId WHERE T2.name = 'Canadian Grand Prix' AND T2.year = 2008 AND T1."TIME" LIKE '_:%:__.___'

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 (SQLite): 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 '_:%:__.___'
SQL (SQL Server): 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 '_:%:__.___'
SQL (Oracle): SELECT T3.constructorRef, T3.url FROM results T1 INNER JOIN races T2 on T1.raceId = T2.raceId INNER JOIN constructors T3 on T1.constructorId = T3.constructorId WHERE T2.name = 'Singapore Grand Prix' AND T2.year = 2009 AND T1."TIME" LIKE '_:%:__.___'