question
stringlengths 23
286
| db_id
stringclasses 11
values | evidence
stringlengths 0
468
| SQL
stringlengths 35
1.58k
| difficulty
stringclasses 3
values | question_id
int64 5
1.53k
|
---|---|---|---|---|---|
What is the average lap time for Lewis Hamilton in the 2009 Malaysian Grand Prix? | formula_1 | 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' | 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' | moderate | 895 |
Calculate the percentage whereby Hamilton was not at the 1st track of the the f1 circuit since 2010. | formula_1 | percentage = DIVIDE(COUNT(raceId) where surname = 'Hamilton' and position>1), (COUNT(raceId) where surname = 'Hamilton'); since 2010 refers to year >= 2010 | SELECT
CAST(COUNT(CASE WHEN `T2`.`position` <> 1 THEN `T2`.`position` END) AS DOUBLE) * 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 | challenging | 896 |
Name the driver with the most winning. Mention his nationality and what is his maximum point scores. | formula_1 | 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); | 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 | moderate | 897 |
How old is the youngest Japanese driver? What is his name? | formula_1 | date of birth refers to drivers.dob; The larger the birthday value, the younger the person is, and vice versa; Japanese refers to nationality = 'Japanese'; age = YEAR(CURRENT_TIMESTAMP) - YEAR(dob); | SELECT
DATE_FORMAT(CAST(CURRENT_TIMESTAMP() AS DATETIME), '%Y') - DATE_FORMAT(CAST(`dob` AS DATETIME), '%Y'),
`forename`,
`surname`
FROM `drivers`
WHERE
`nationality` = 'Japanese'
ORDER BY
`dob` DESC
LIMIT 1 | simple | 898 |
Name the races along with its circuit name and location for f1 races hosted in September 2005. | formula_1 | in September 2005 refers to MONTH(date) = 9 and YEAR(date) = 2005 | 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 DATE_FORMAT(CAST(`T2`.`date` AS DATETIME), '%m') = '09' | simple | 901 |
Which race was Alex Yoong in when he was in track number less than 20? | formula_1 | 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 | 902 |
State the race and year of race in which Michael Schumacher had his fastest lap. | formula_1 | fastest lap refers to min(milliseconds); Alex Yoong refers to the full name of the driver; Full name of the driver refers to drivers.forename and drivers.surname; | 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 | 904 |
Which was Lewis Hamilton first race? What was his points recorded for his first race event? | formula_1 | 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 | 906 |
Among all European Grand Prix races, what is the percentage of the races were hosted in Germany? | formula_1 | European Grand Prix races refers to races.name = 'European Grand Prix';percentage = divide(COUNT(races where country = Germany and name = 'Europearn Grand Prix'),COUNT(races where name = 'Europearn Grand Prix'))*100 | SELECT
CAST(COUNT(CASE WHEN `T1`.`country` = 'Germany' THEN `T2`.`circuitID` END) AS DOUBLE) * 100 / COUNT(`T2`.`circuitId`)
FROM `circuits` AS `T1`
INNER JOIN `races` AS `T2`
ON `T2`.`circuitID` = `T1`.`circuitId`
WHERE
`T2`.`name` = 'European Grand Prix' | moderate | 909 |
What's the location coordinates of Silverstone Circuit? | formula_1 | location coordinates refers to (lat, lng); Silverstone Circuit refers to circuits.name = 'Silverstone Circuit' | SELECT
`lat`,
`lng`
FROM `circuits`
WHERE
`name` = 'Silverstone Circuit' | simple | 910 |
What's the reference name of Marina Bay Street Circuit? | formula_1 | 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 | 912 |
Which country is the oldest driver from? | formula_1 | 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
NOT `dob` IS NULL
ORDER BY
`dob` ASC
LIMIT 1 | simple | 915 |
Which driver ranked the first in the Canadian Grand Prix in 2007? Please give his reference name. | formula_1 | reference name refers to driverRef; Canadian Grand Prix refers to races.name = 'Canadian Grand Prix'; | SELECT
`T3`.`forename`,
`T3`.`surname`,
`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`.`rank` = 1 AND `T1`.`year` = 2007 | moderate | 928 |
In which Formula_1 race did Lewis Hamilton rank the highest? | formula_1 | 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 | 930 |
What was the fastest lap speed among all drivers in the 2009 Spanish Grand Prix? | formula_1 | 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 NOT `T2`.`fastestLapSpeed` IS NULL
ORDER BY
`T2`.`fastestLapSpeed` DESC
LIMIT 1 | moderate | 931 |
What was Lewis Hamilton's final rank in the 2008 Chinese Grand Prix? | formula_1 | 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 | 933 |
What's the finish time for the driver who ranked second in 2008's Chinese Grand Prix? | formula_1 | 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 | 937 |
Among the drivers that finished the race in the 2008 Chinese Grand Prix, how many of them have participated in Formula_1 races? | formula_1 | COUNT(raceID) > 0 reveals that this driver participated in races; drivers who finished the race refers to time has value. | 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) AS derived_table | moderate | 940 |
How much faster in percentage is the champion than the driver who finished the race last in the 2008 Australian Grand Prix? | formula_1 | 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 DOUBLE) * 3600
) + (
CAST(SUBSTR(`T1`.`time`, 3, 2) AS DOUBLE) * 60
) + CAST(SUBSTR(`T1`.`time`, 6) AS DOUBLE)
ELSE CAST(SUBSTR(`T1`.`time`, 2) AS DOUBLE)
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 NOT `T1`.`time` IS 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 DOUBLE) * 100
) / (
SELECT
`time_seconds` + (
SELECT
`time_seconds`
FROM `last_driver_incremental`
)
FROM `champion_time`
) | challenging | 944 |
How many circuits are there in Adelaide, Australia? | formula_1 | Australia is the country; Melbourne is the location of circuit; | SELECT
COUNT(`circuitId`)
FROM `circuits`
WHERE
`location` = 'Adelaide' AND `country` = 'Australia' | simple | 945 |
What are the maximum points of British constructors? | formula_1 | maximum points = MAX(points); British is a nationality | SELECT
MAX(`T1`.`points`)
FROM `constructorStandings` AS `T1`
INNER JOIN `constructors` AS `T2`
ON `T1`.`constructorId` = `T2`.`constructorId`
WHERE
`T2`.`nationality` = 'British' | simple | 948 |
Please list the constructor names with 0 points at race 291. | formula_1 | 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 | 950 |
How many Japanese constructors have 0 points in 2 races? | formula_1 | 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 | 951 |
Please calculate the race completion percentage of Japanese drivers from 2007 to 2009. | formula_1 | 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(CASE WHEN NOT `T1`.`time` IS NULL THEN 1 ELSE 0 END) AS DOUBLE) * 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 | 954 |
What is the average time in seconds of champion for each year, before year 1975? | formula_1 | 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 time_in_seconds AS (SELECT T2.year, T2.raceId, T1.positionOrder, CASE WHEN T1.positionOrder = 1 THEN (CAST(SUBSTR(T1.time, 1, 1) AS FLOAT) * 3600) + (CAST(SUBSTR(T1.time, 3, 2) AS FLOAT) * 60) + CAST(SUBSTR(T1.time, 6, 2) AS FLOAT) + CAST(SUBSTR(T1.time, 9) AS FLOAT) / 1000 ELSE 0 END AS time_seconds FROM results AS T1 INNER JOIN races AS T2 ON T1.raceId = T2.raceId WHERE NOT T1.time IS 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 NOT AVG(time_seconds) IS NULL | challenging | 955 |
What is the fastest lap number of the champion in 2009? | formula_1 | in 2009 refers to year = 2009; Only the time of the champion shows in the format of "hour: minutes: seconds.millionsecond" | 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 '_:%:__.___' | simple | 959 |
What is the average of fastest lap speed in the 2009 Spanish Grand Prix race? | formula_1 | 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 | 960 |
From 2000 to 2005, what percentage of drivers who were born before 1985 and the lap numbers were over 50? | formula_1 | 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(
CASE
WHEN DATE_FORMAT(CAST(`T3`.`dob` AS DATETIME), '%Y') < '1985' AND `T1`.`laps` > 50
THEN 1
ELSE 0
END
) AS DOUBLE) * 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 | 962 |
How many French drivers who obtain the laptime less than 02:00.00? | formula_1 | lap time less than 02:00.00 refers to seconds < 120; | 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 SIGNED) * 60 + CAST(SUBSTR(`T2`.`time`, 4, 2) AS SIGNED) + CAST(SUBSTR(`T2`.`time`, 7, 2) AS DOUBLE) / 1000
) < 120 | moderate | 963 |
List out the code for drivers who have nationality in American. | formula_1 | nationality = 'American' | SELECT `code` FROM `drivers` WHERE `Nationality` = 'American' | simple | 964 |
State code numbers of top 3 yougest drivers. How many Netherlandic drivers among them? | formula_1 | youngest driver refers to Max (year(dob)); Netherlandic and Dutch refer to the same country | SELECT COUNT(*) FROM (SELECT `T1`.`nationality` FROM `drivers` AS `T1` ORDER BY `T1`.`dob` DESC LIMIT 3) AS `T3` WHERE `T3`.`nationality` = 'Dutch' | simple | 967 |
Please state the reference name of the oldest German driver. | formula_1 | oldest refers to MIN(year(dob)); reference names appear in drverRef. | SELECT `driverRef` FROM `drivers` WHERE `nationality` = 'German' ORDER BY `dob` ASC LIMIT 1 | simple | 971 |
Which drivers who were born in 1971 and has the fastest lap time on the race? Give id and code of these drivers. | formula_1 | born in 1971 refers to year(dob) = 1971; has the fastest lap time refers to fastestLapTime has values | SELECT
`T2`.`driverId`,
`T2`.`code`
FROM `results` AS `T1`
INNER JOIN `drivers` AS `T2`
ON `T1`.`driverId` = `T2`.`driverId`
WHERE
DATE_FORMAT(CAST(`T2`.`dob` AS DATETIME), '%Y') = '1971'
AND NOT `T1`.`fastestLapTime` IS NULL | moderate | 972 |
From race no. 50 to 100, how many finishers have been disqualified? | formula_1 | disqualified refers to statusID = 2, finisher refers to time! = null; race no. refers to raceId; raceId > 50 and raceId < 100; | SELECT
SUM(CASE WHEN NOT `time` IS NULL THEN 1 ELSE 0 END)
FROM `results`
WHERE
`statusId` = 2 AND `raceID` < 100 AND `raceId` > 50 | simple | 977 |
How many times the circuits were held in Austria? Please give their location and coordinates. | formula_1 | location coordinates refers to (lat,lng); Austria refers to country = 'Austria'; | SELECT DISTINCT
`location`,
`lat`,
`lng`
FROM `circuits`
WHERE
`country` = 'Austria' | simple | 978 |
On what year did the youngest driver had his first qualifying race? Also state the name, date and time of the race. | formula_1 | 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); | 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 | moderate | 981 |
List down top 3 German drivers who has the shortest average pit stop duration and were born between 1980-1985. | formula_1 | 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 DATE_FORMAT(CAST(`T2`.`dob` AS DATETIME), '%Y') BETWEEN '1980' AND '1985'
GROUP BY
`T2`.`forename`,
`T2`.`surname`
ORDER BY
AVG(`T1`.`duration`)
LIMIT 3 | challenging | 988 |
Who is the champion of the Canadian Grand Prix in 2008? Indicate his finish time. | formula_1 | 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 | 989 |
What is the constructor reference name of the champion in the 2009 Singapore Grand Prix? Please give its website. | formula_1 | 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 | 990 |
Please list all the superpowers of 3-D Man. | superhero | 3-D Man refers to superhero_name = '3-D Man'; superpowers refers to power_name | SELECT `T3`.`power_name` FROM `superhero` AS `T1` INNER JOIN `hero_power` AS `T2` ON `T1`.`id` = `T2`.`hero_id` INNER JOIN `superpower` AS `T3` ON `T2`.`power_id` = `T3`.`id` WHERE `T1`.`superhero_name` = '3-D Man' | simple | 717 |
Which constructor scored most points from Monaco Grand Prix between 1980 and 2010? List the score, name and nationality of this team. | formula_1 | 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 | 994 |
What is full name of the racer who ranked 1st in the 3rd qualifying race held in the Marina Bay Street Circuit in 2008? | formula_1 | Ranked 1st in the 3rd qualifying race refer to MIN(q3); 2008 is the year of race; full name of racer = forename, surname | SELECT
`T2`.`forename`,
`T2`.`surname`
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
NOT `q3` IS NULL
AND `T3`.`year` = 2008
AND `T3`.`circuitId` IN (
SELECT
`circuitId`
FROM `circuits`
WHERE
`name` = 'Marina Bay Street Circuit'
)
ORDER BY
CAST(SUBSTR(`q3`, 1, INSTR(`q3`, ':') - 1) AS SIGNED) * 60 + CAST(SUBSTR(`q3`, INSTR(`q3`, ':') + 1, INSTR(`q3`, '.') - INSTR(`q3`, ':') - 1) AS DOUBLE) + CAST(SUBSTR(`q3`, INSTR(`q3`, '.') + 1) AS DOUBLE) / 1000 ASC
LIMIT 1 | challenging | 1,001 |
As of the present, what is the full name of the youngest racer? Indicate her nationality and the name of the race to which he/she first joined. | formula_1 | full name refers to forename+surname; Youngest racer = MAX(dob) | SELECT `T1`.`forename`, `T1`.`surname`, `T1`.`nationality`, `T3`.`name` FROM `drivers` AS `T1` INNER JOIN `driverStandings` AS `T2` ON `T1`.`driverId` = `T2`.`driverId` INNER JOIN `races` AS `T3` ON `T2`.`raceId` = `T3`.`raceId` ORDER BY `T1`.`dob` DESC LIMIT 1 | moderate | 1,002 |
How many accidents did the driver who had the highest number accidents in the Canadian Grand Prix have? | formula_1 | number of accidents refers to the number where statusid = 3; Canadian Grand Prix refers to the race of name
| SELECT
COUNT(`T1`.`driverId`)
FROM `results` AS `T1`
INNER JOIN `races` AS `T2`
ON `T1`.`raceId` = `T2`.`raceId`
INNER JOIN `status` AS `T3`
ON `T1`.`statusId` = `T3`.`statusId`
WHERE
`T3`.`statusId` = 3 AND `T2`.`name` = 'Canadian Grand Prix'
GROUP BY
`T1`.`driverId`
ORDER BY
COUNT(`T1`.`driverId`) DESC
LIMIT 1 | moderate | 1,003 |
Which top 20 driver created the shortest lap time ever record in a Formula_1 race? Please give them full names. | formula_1 | shortest lap time refers to MIN(time); the time format for the shortest lap time is 'MM:SS.mmm' or 'M:SS.mmm'; full name of the driver refers to forename, surname | WITH lap_times_in_seconds AS (SELECT driverId, (CASE WHEN SUBSTR(time, 1, INSTR(time, ':') - 1) <> '' THEN CAST(SUBSTR(time, 1, INSTR(time, ':') - 1) AS FLOAT) * 60 ELSE 0 END + CASE WHEN SUBSTR(time, INSTR(time, ':') + 1, INSTR(time, '.') - INSTR(time, ':') - 1) <> '' THEN CAST(SUBSTR(time, INSTR(time, ':') + 1, INSTR(time, '.') - INSTR(time, ':') - 1) AS FLOAT) ELSE 0 END + CASE WHEN SUBSTR(time, INSTR(time, '.') + 1) <> '' THEN CAST(SUBSTR(time, INSTR(time, '.') + 1) AS FLOAT) / 1000 ELSE 0 END) AS time_in_seconds FROM lapTimes) SELECT T2.forename, T2.surname, T1.driverId FROM (SELECT driverId, MIN(time_in_seconds) AS min_time_in_seconds FROM lap_times_in_seconds GROUP BY driverId) AS T1 INNER JOIN drivers AS T2 ON T1.driverId = T2.driverId ORDER BY T1.min_time_in_seconds ASC LIMIT 20 | challenging | 1,011 |
Please list the lap records for the circuits in Italy. | formula_1 | lap record means the fastest time recorded which refers to time | WITH `fastest_lap_times` AS (
SELECT
`T1`.`raceId`,
`T1`.`FastestLapTime`,
(
CAST(SUBSTR(`T1`.`FastestLapTime`, 1, INSTR(`T1`.`FastestLapTime`, ':') - 1) AS DOUBLE) * 60
) + (
CAST(SUBSTR(
`T1`.`FastestLapTime`,
INSTR(`T1`.`FastestLapTime`, ':') + 1,
INSTR(`T1`.`FastestLapTime`, '.') - INSTR(`T1`.`FastestLapTime`, ':') - 1
) AS DOUBLE)
) + (
CAST(SUBSTR(`T1`.`FastestLapTime`, INSTR(`T1`.`FastestLapTime`, '.') + 1) AS DOUBLE) / 1000
) AS `time_in_seconds`
FROM `results` AS `T1`
WHERE
NOT `T1`.`FastestLapTime` IS NULL
)
SELECT
`T1`.`FastestLapTime` AS `lap_record`
FROM `results` AS `T1`
INNER JOIN `races` AS `T2`
ON `T1`.`raceId` = `T2`.`raceId`
INNER JOIN `circuits` AS `T3`
ON `T2`.`circuitId` = `T3`.`circuitId`
INNER JOIN (
SELECT
MIN(`fastest_lap_times`.`time_in_seconds`) AS `min_time_in_seconds`
FROM `fastest_lap_times`
INNER JOIN `races` AS `T2`
ON `fastest_lap_times`.`raceId` = `T2`.`raceId`
INNER JOIN `circuits` AS `T3`
ON `T2`.`circuitId` = `T3`.`circuitId`
WHERE
`T3`.`country` = 'Italy'
) AS `T4`
ON (
CAST(SUBSTR(`T1`.`FastestLapTime`, 1, INSTR(`T1`.`FastestLapTime`, ':') - 1) AS DOUBLE) * 60
) + (
CAST(SUBSTR(
`T1`.`FastestLapTime`,
INSTR(`T1`.`FastestLapTime`, ':') + 1,
INSTR(`T1`.`FastestLapTime`, '.') - INSTR(`T1`.`FastestLapTime`, ':') - 1
) AS DOUBLE)
) + (
CAST(SUBSTR(`T1`.`FastestLapTime`, INSTR(`T1`.`FastestLapTime`, '.') + 1) AS DOUBLE) / 1000
) = `T4`.`min_time_in_seconds`
LIMIT 1 | challenging | 1,014 |
Among the superheroes with the super power of "Super Strength", how many of them have a height of over 200cm? | superhero | super power of "Super Strength" refers to power_name = 'Super Strength'; a height of over 200cm refers to height_cm > 200 | SELECT
COUNT(`T1`.`id`)
FROM `superhero` AS `T1`
INNER JOIN `hero_power` AS `T2`
ON `T1`.`id` = `T2`.`hero_id`
INNER JOIN `superpower` AS `T3`
ON `T2`.`power_id` = `T3`.`id`
WHERE
`T3`.`power_name` = 'Super Strength' AND `T1`.`height_cm` > 200 | moderate | 719 |
Among the superheroes with blue eyes, how many of them have the super power of "Agility"? | superhero | blue eyes refers to colour = 'Blue' and eye_colour_id = colour.id; super power of "Agility" refers to power_name = 'Agility' | SELECT
COUNT(`T1`.`id`)
FROM `superhero` AS `T1`
INNER JOIN `hero_power` AS `T2`
ON `T1`.`id` = `T2`.`hero_id`
INNER JOIN `superpower` AS `T3`
ON `T2`.`power_id` = `T3`.`id`
INNER JOIN `colour` AS `T4`
ON `T1`.`eye_colour_id` = `T4`.`id`
WHERE
`T3`.`power_name` = 'Agility' AND `T4`.`colour` = 'Blue' | moderate | 723 |
Please list the superhero names of all the superheroes that have blue eyes and blond hair. | superhero | blue eyes refers to colour = 'Blue' and eye_colour_id = colour.id; blond hair refers to colour = 'Blond' and hair_colour_id = colour.id; super power of "Agility" refers to power_name = 'Agility' | SELECT
`T1`.`superhero_name`
FROM `superhero` AS `T1`
INNER JOIN `colour` AS `T2`
ON `T1`.`eye_colour_id` = `T2`.`id`
INNER JOIN `colour` AS `T3`
ON `T1`.`hair_colour_id` = `T3`.`id`
WHERE
`T2`.`colour` = 'Blue' AND `T3`.`colour` = 'Blond' | challenging | 724 |
Rank heroes published by Marvel Comics by their height in descending order. | superhero | name refers to superhero_name; the tallest hero refers to MAX(height_cm); published by Marvel Comics refers to publisher_name = 'Marvel Comics' | SELECT
`superhero_name`,
`height_cm`,
RANK() OVER (ORDER BY `height_cm` DESC) AS `HeightRank`
FROM `superhero`
INNER JOIN `publisher`
ON `superhero`.`publisher_id` = `publisher`.`id`
WHERE
`publisher`.`publisher_name` = 'Marvel Comics' | moderate | 726 |
Rank superheroes from Marvel Comics by their eye color popularity, starting with the most common color. | superhero | the superheroes from Marvel Comics refers to publisher_name = 'Marvel Comics'; most common color refers to COUNT(superhero.id) DESC; | SELECT
`colour`.`colour` AS `EyeColor`,
COUNT(`superhero`.`id`) AS `Count`,
RANK() OVER (ORDER BY COUNT(`superhero`.`id`) DESC) AS `PopularityRank`
FROM `superhero`
INNER JOIN `colour`
ON `superhero`.`eye_colour_id` = `colour`.`id`
INNER JOIN `publisher`
ON `superhero`.`publisher_id` = `publisher`.`id`
WHERE
`publisher`.`publisher_name` = 'Marvel Comics'
GROUP BY
`colour`.`colour` | moderate | 728 |
List the superheroes from Marvel Comics who have the super power of 'Super Strength'. | superhero | the superheroes from Marvel Comics refers to publisher_name = 'Marvel Comics'; super power of "Super Strength" refers to power_name = 'Super Strength'; | SELECT
`superhero_name`
FROM `superhero` AS `T1`
WHERE
EXISTS(
SELECT
1
FROM `hero_power` AS `T2`
INNER JOIN `superpower` AS `T3`
ON `T2`.`power_id` = `T3`.`id`
WHERE
`T3`.`power_name` = 'Super Strength' AND `T1`.`id` = `T2`.`hero_id`
)
AND EXISTS(
SELECT
1
FROM `publisher` AS `T4`
WHERE
`T4`.`publisher_name` = 'Marvel Comics' AND `T1`.`publisher_id` = `T4`.`id`
) | challenging | 730 |
Which publisher published the slowest superhero? | superhero | the slowest superhero refers to attribute_name = 'Speed' where MIN(attribute_value); publisher refers to publisher_name | SELECT
`T2`.`publisher_name`
FROM `superhero` AS `T1`
INNER JOIN `publisher` AS `T2`
ON `T1`.`publisher_id` = `T2`.`id`
INNER JOIN `hero_attribute` AS `T3`
ON `T1`.`id` = `T3`.`hero_id`
INNER JOIN `attribute` AS `T4`
ON `T3`.`attribute_id` = `T4`.`id`
WHERE
`T4`.`attribute_name` = 'Speed'
ORDER BY
`T3`.`attribute_value`
LIMIT 1 | moderate | 732 |
How many gold-eyed superheroes did Marvel Comics publish? | superhero | gold-eyed refers to colour = 'Gold' where eye_colour_id = colour.id; superheroes that Marvel Comics published refers to publisher_name = 'Marvel Comics' | SELECT
COUNT(`T1`.`id`)
FROM `superhero` AS `T1`
INNER JOIN `publisher` AS `T2`
ON `T1`.`publisher_id` = `T2`.`id`
INNER JOIN `colour` AS `T3`
ON `T1`.`eye_colour_id` = `T3`.`id`
WHERE
`T2`.`publisher_name` = 'Marvel Comics' AND `T3`.`colour` = 'Gold' | moderate | 733 |
Who is the dumbest superhero? | superhero | the dumbest superhero refers to MIN(attribute_value) where attribute_name = 'Intelligence' | SELECT
`T1`.`superhero_name`
FROM `superhero` AS `T1`
INNER JOIN `hero_attribute` AS `T2`
ON `T1`.`id` = `T2`.`hero_id`
INNER JOIN `attribute` AS `T3`
ON `T2`.`attribute_id` = `T3`.`id`
WHERE
`T3`.`attribute_name` = 'Intelligence'
ORDER BY
`T2`.`attribute_value`
LIMIT 1 | moderate | 736 |
What is Copycat's race? | superhero | Copycat is the superhero_name; | SELECT
`T2`.`race`
FROM `superhero` AS `T1`
INNER JOIN `race` AS `T2`
ON `T1`.`race_id` = `T2`.`id`
WHERE
`T1`.`superhero_name` = 'Copycat' | simple | 737 |
Which superheroes have a durability attribute value of less than 50? | superhero | durability of less than 50 refers to attribute_name = 'Durability' AND attribute_value < 50 | SELECT
`superhero_name`
FROM `superhero` AS `T1`
WHERE
EXISTS(
SELECT
1
FROM `hero_attribute` AS `T2`
INNER JOIN `attribute` AS `T3`
ON `T2`.`attribute_id` = `T3`.`id`
WHERE
`T3`.`attribute_name` = 'Durability'
AND `T2`.`attribute_value` < 50
AND `T1`.`id` = `T2`.`hero_id`
) | simple | 738 |
What are the names of the superheroes with the power of death touch? | superhero | name of superheroes refers to refers to superhero_name; the power of death touch refers to power_name = 'Death Touch' | SELECT
`T1`.`superhero_name`
FROM `superhero` AS `T1`
INNER JOIN `hero_power` AS `T2`
ON `T1`.`id` = `T2`.`hero_id`
INNER JOIN `superpower` AS `T3`
ON `T2`.`power_id` = `T3`.`id`
WHERE
`T3`.`power_name` = 'Death Touch' | moderate | 739 |
How many female superheroes have a strength value of 100? | superhero | female refers to gender = 'Female'; strength value of 100 refers to attribute_name = 'Strength' AND attribute_value = 100 | SELECT
COUNT(`T1`.`id`)
FROM `superhero` AS `T1`
INNER JOIN `hero_attribute` AS `T2`
ON `T1`.`id` = `T2`.`hero_id`
INNER JOIN `attribute` AS `T3`
ON `T2`.`attribute_id` = `T3`.`id`
INNER JOIN `gender` AS `T4`
ON `T1`.`gender_id` = `T4`.`id`
WHERE
`T3`.`attribute_name` = 'Strength'
AND `T2`.`attribute_value` = 100
AND `T4`.`gender` = 'Female' | moderate | 740 |
What is the percentage of superheroes who act in their own self-interest or make decisions based on their own moral code? Indicate how many of the said superheroes were published by Marvel Comics. | superhero | published by Marvel Comics refers to publisher_name = 'Marvel Comics'; superheroes who act in their own self-interest or make decisions based on their own moral code refers to alignment = 'Bad'; calculation = MULTIPLY(DIVIDE(SUM(alignment = 'Bad); count(id)), 100) | SELECT
(
CAST(COUNT(*) AS DOUBLE) * 100 / (
SELECT
COUNT(*)
FROM `superhero`
)
),
CAST(SUM(CASE WHEN `T2`.`publisher_name` = 'Marvel Comics' THEN 1 ELSE 0 END) AS DOUBLE)
FROM `superhero` AS `T1`
INNER JOIN `publisher` AS `T2`
ON `T1`.`publisher_id` = `T2`.`id`
INNER JOIN `alignment` AS `T3`
ON `T3`.`id` = `T1`.`alignment_id`
WHERE
`T3`.`alignment` = 'Bad' | challenging | 743 |
Between DC and Marvel Comics, which publisher has published more superheroes? Find the difference in the number of superheroes they have published. | superhero | DC refers to publisher_name = 'DC Comics'; Marvel Comics refers to publisher_name = 'Marvel Comics'; calculation = SUBTRACT(SUM(publisher_name = 'Marvel Comics'), SUM(publisher_name = 'DC Comics')) | SELECT
SUM(CASE WHEN `T2`.`publisher_name` = 'Marvel Comics' THEN 1 ELSE 0 END) - SUM(CASE WHEN `T2`.`publisher_name` = 'DC Comics' THEN 1 ELSE 0 END)
FROM `superhero` AS `T1`
INNER JOIN `publisher` AS `T2`
ON `T1`.`publisher_id` = `T2`.`id` | challenging | 744 |
Give the publisher ID of Star Trek. | superhero | Star Trek is the publisher_name; | SELECT
`id`
FROM `publisher`
WHERE
`publisher_name` = 'Star Trek' | simple | 745 |
What is the total number of superheroes without full name? | superhero | superheroes without full name refers to full_name IS NULL | SELECT
COUNT(`id`)
FROM `superhero`
WHERE
`full_name` IS NULL | simple | 747 |
What is the average weight of all female superheroes? | superhero | female refers to gender = 'Female'; average weight refers to AVG(weight_kg) | SELECT
AVG(`T1`.`weight_kg`)
FROM `superhero` AS `T1`
INNER JOIN `gender` AS `T2`
ON `T1`.`gender_id` = `T2`.`id`
WHERE
`T2`.`gender` = 'Female' | simple | 750 |
List down at least five superpowers of male superheroes. | superhero | male refers to gender = 'Male'; superpowers refers to power_name; | SELECT
`T3`.`power_name`
FROM `superhero` AS `T1`
INNER JOIN `hero_power` AS `T2`
ON `T1`.`id` = `T2`.`hero_id`
INNER JOIN `superpower` AS `T3`
ON `T3`.`id` = `T2`.`power_id`
INNER JOIN `gender` AS `T4`
ON `T4`.`id` = `T1`.`gender_id`
WHERE
`T4`.`gender` = 'Male'
LIMIT 5 | moderate | 751 |
Among the superheroes with height from 170 to 190, list the names of the superheroes with no eye color. | superhero | height from 170 to 190 refers to height_cm BETWEEN 170 AND 190; no eye color refers to colour = 'No Colour' | SELECT DISTINCT
`T1`.`superhero_name`
FROM `superhero` AS `T1`
INNER JOIN `colour` AS `T2`
ON `T1`.`eye_colour_id` = `T2`.`id`
WHERE
`T1`.`height_cm` BETWEEN 170 AND 190 AND `T2`.`colour` = 'No Colour' | moderate | 753 |
Provide the hair colour of the human superhero who is 185 cm tall. | superhero | 185 cm tall refers to height_cm = 185; human superhero refers to race = 'human'; hair colour refers to colour where hair_colour_id = colour.id; | SELECT DISTINCT
`T3`.`colour`
FROM `superhero` AS `T1`
INNER JOIN `race` AS `T2`
ON `T1`.`race_id` = `T2`.`id`
INNER JOIN `colour` AS `T3`
ON `T1`.`hair_colour_id` = `T3`.`id`
WHERE
`T1`.`height_cm` = 185 AND `T2`.`race` = 'Human' | moderate | 758 |
In superheroes with height between 150 to 180, what is the percentage of heroes published by Marvel Comics? | superhero | height between 150 to 180 refers to height_cm BETWEEN 150 AND 180; heroes published by Marvel Comics refers to publisher_name = 'Marvel Comics'; calculation = MULTIPLY(DIVIDE(SUM(publisher.id = 13)), COUNT(publisher.id), 100) | SELECT
CAST(COUNT(CASE WHEN `T2`.`publisher_name` = 'Marvel Comics' THEN 1 ELSE NULL END) AS DOUBLE) * 100 / COUNT(`T1`.`id`)
FROM `superhero` AS `T1`
INNER JOIN `publisher` AS `T2`
ON `T1`.`publisher_id` = `T2`.`id`
WHERE
`T1`.`height_cm` BETWEEN 150 AND 180 | challenging | 760 |
Among the male superheroes, list the super hero names of superheroes with weight greater than the 79% average weight of all superheroes. | superhero | super hero names refers to superhero_name;male superheros refers to gender = 'Male';Calculation = weight_kg > MULTIPLY(AVG(weight_kg), 0.79) | SELECT
`T1`.`superhero_name`
FROM `superhero` AS `T1`
INNER JOIN `gender` AS `T2`
ON `T1`.`gender_id` = `T2`.`id`
WHERE
`T2`.`gender` = 'Male'
AND `T1`.`weight_kg` * 100 > (
SELECT
AVG(`weight_kg`)
FROM `superhero`
) * 79 | moderate | 761 |
What are the superpowers of heroes with ID 1? | superhero | superpowers refers to power_name; heroes with ID 1 refers to hero_id = 1; | SELECT DISTINCT
`T2`.`power_name`
FROM `hero_power` AS `T1`
INNER JOIN `superpower` AS `T2`
ON `T1`.`power_id` = `T2`.`id`
WHERE
`T1`.`hero_id` = 1 | simple | 764 |
How many heroes have stealth power? | superhero | stealth power refers to power_name = 'Stealth'; | SELECT
COUNT(`T1`.`hero_id`)
FROM `hero_power` AS `T1`
INNER JOIN `superpower` AS `T2`
ON `T1`.`power_id` = `T2`.`id`
WHERE
`T2`.`power_name` = 'Stealth' | simple | 765 |
What is the hero's full name with the highest attribute in strength? | superhero | highest attribute in strength refers to MAX(attribute_value) WHERE attribute_name = 'strength'; | SELECT `T1`.`full_name` FROM `superhero` AS `T1` INNER JOIN `hero_attribute` AS `T2` ON `T1`.`id` = `T2`.`hero_id` INNER JOIN `attribute` AS `T3` ON `T2`.`attribute_id` = `T3`.`id` WHERE `T3`.`attribute_name` = 'Strength' ORDER BY `T2`.`attribute_value` DESC LIMIT 1 | moderate | 766 |
Which superhero has the most durability published by Dark Horse Comics? | superhero | which superhero refers to superhero_name; most durability refers to MAX(attribute_value) WHERE attribute_name = 'durability'; published by Dark Horse Comics refers to publisher_name = 'Dark Horse Comics'; | SELECT
`T1`.`superhero_name`
FROM `superhero` AS `T1`
INNER JOIN `hero_attribute` AS `T2`
ON `T1`.`id` = `T2`.`hero_id`
INNER JOIN `attribute` AS `T3`
ON `T3`.`id` = `T2`.`attribute_id`
INNER JOIN `publisher` AS `T4`
ON `T4`.`id` = `T1`.`publisher_id`
WHERE
`T4`.`publisher_name` = 'Dark Horse Comics'
AND `T3`.`attribute_name` = 'Durability'
ORDER BY
`T2`.`attribute_value` DESC
LIMIT 1 | challenging | 769 |
List the eyes, hair and skin colour of all female superheroes published by Dark Horse Comics. | superhero | eyes refers to eye_colour_id; hair refers to hair_colour_id; skin colour refers to skin_colour_id; female superheroes refers to gender = 'Female'; published by Dark Horse Comics refers to publisher_name = 'Dark Horse Comics'; | SELECT
`T1`.`eye_colour_id`,
`T1`.`hair_colour_id`,
`T1`.`skin_colour_id`
FROM `superhero` AS `T1`
INNER JOIN `publisher` AS `T2`
ON `T2`.`id` = `T1`.`publisher_id`
INNER JOIN `gender` AS `T3`
ON `T3`.`id` = `T1`.`gender_id`
WHERE
`T2`.`publisher_name` = 'Dark Horse Comics' AND `T3`.`gender` = 'Female' | challenging | 772 |
Which superhero has the same eyes, hair and skin colour? Indicate the publisher of the superhero. | superhero | which superhero refers to superhero_name; the same eyes, hair and skin colour refers to hair_colour_id = skin_colour_id AND hair_colour_id = eye_colour_id; publisher refers to publisher_name; | SELECT
`T1`.`superhero_name`,
`T2`.`publisher_name`
FROM `superhero` AS `T1`
INNER JOIN `publisher` AS `T2`
ON `T1`.`publisher_id` = `T2`.`id`
WHERE
`T1`.`eye_colour_id` = `T1`.`hair_colour_id`
AND `T1`.`eye_colour_id` = `T1`.`skin_colour_id` | challenging | 773 |
What is the percentage of blue female superheroes among all female superheroes? | superhero | percentage = MULTIPLY(DIVIDE(SUM(colour = 'Blue' WHERE gender = 'Female'), COUNT(gender = 'Female')), 100); blue refers to the color = 'Blue' WHERE skin_colour_id = colour.id; female refers to gender = 'Female'; | SELECT
CAST(COUNT(CASE WHEN `T3`.`colour` = 'Blue' THEN `T1`.`id` ELSE NULL END) AS DOUBLE) * 100 / COUNT(`T1`.`id`)
FROM `superhero` AS `T1`
INNER JOIN `gender` AS `T2`
ON `T1`.`gender_id` = `T2`.`id`
INNER JOIN `colour` AS `T3`
ON `T1`.`skin_colour_id` = `T3`.`id`
WHERE
`T2`.`gender` = 'Female' | challenging | 775 |
How many powers does Amazo hero have? | superhero | Amazo hero refers to superhero_name = 'Amazo'; | SELECT
COUNT(`T1`.`power_id`)
FROM `hero_power` AS `T1`
INNER JOIN `superhero` AS `T2`
ON `T1`.`hero_id` = `T2`.`id`
WHERE
`T2`.`superhero_name` = 'Amazo' | simple | 779 |
Provide the heights of the heroes whose eye colours are amber. | superhero | heights of the heroes refers to height_cm; eye colours are amber refers to colour.colour = 'Amber' WHERE eye_colour_id = colour.id; | SELECT
`T1`.`height_cm`
FROM `superhero` AS `T1`
INNER JOIN `colour` AS `T2`
ON `T1`.`eye_colour_id` = `T2`.`id`
WHERE
`T2`.`colour` = 'Amber' | simple | 781 |
List the heroes' names whose eyes and hair colours are both black. | superhero | heroes' names refers to superhero_name; eyes and hair colours are both black refers to eye_colour_id AND hair_colour_id WHERE colour.colour = 'Black'; | SELECT
`T1`.`superhero_name`
FROM `superhero` AS `T1`
INNER JOIN `colour` AS `T2`
ON `T1`.`eye_colour_id` = `T2`.`id` AND `T1`.`hair_colour_id` = `T2`.`id`
WHERE
`T2`.`colour` = 'Black' | moderate | 782 |
Describe the names of neutral alignment superheroes. | superhero | names of superheroes refers to superhero_name; neutral alignment refers to alignment = 'Neutral'; | SELECT
`T1`.`superhero_name`
FROM `superhero` AS `T1`
INNER JOIN `alignment` AS `T2`
ON `T1`.`alignment_id` = `T2`.`id`
WHERE
`T2`.`alignment` = 'Neutral' | simple | 785 |
How many heroes have the highest attribute value in strength? | superhero | highest attribute value in strength refers to MAX(attribute_value) WHERE attribute_name = 'Strength'; | SELECT
COUNT(`T1`.`hero_id`)
FROM `hero_attribute` AS `T1`
INNER JOIN `attribute` AS `T2`
ON `T1`.`attribute_id` = `T2`.`id`
WHERE
`T2`.`attribute_name` = 'Strength'
AND `T1`.`attribute_value` = (
SELECT
MAX(`attribute_value`)
FROM `hero_attribute`
) | moderate | 786 |
How many percent of female heroes were published by Marvel Comics? | superhero | percent = MULTIPLY(DIVIDE(SUM(gender = 'Female' WHERE publisher_name = 'Marvel Comics'), COUNT(publisher_name = 'Marvel Comics')), 100); female heroes refers to gender = 'Female'; Marvel Comics refers to publisher_name = 'Marvel Comics'; | SELECT
CAST(COUNT(CASE WHEN `T2`.`publisher_name` = 'Marvel Comics' AND `T3`.`gender` = 'Female' THEN 1 ELSE NULL END) AS DOUBLE) * 100 / COUNT(CASE WHEN `T2`.`publisher_name` = 'Marvel Comics' THEN 1 ELSE NULL END)
FROM `superhero` AS `T1`
INNER JOIN `publisher` AS `T2`
ON `T1`.`publisher_id` = `T2`.`id`
INNER JOIN `gender` AS `T3`
ON `T1`.`gender_id` = `T3`.`id`
| challenging | 788 |
Calculate the difference between Emil Blonsky's weight and Charles Chandler's weight. | superhero | difference = SUBTRACT(SUM(weight_kg WHERE full_name = 'Emil Blonsky'), SUM(weight_kg WHERE full_name = 'Charles Chandler')); Emil Blonsky is the full name of superhero; Charles Chandler is the full name of superhero; | SELECT
(
SELECT
`weight_kg`
FROM `superhero`
WHERE
`full_name` LIKE 'Emil Blonsky'
) - (
SELECT
`weight_kg`
FROM `superhero`
WHERE
`full_name` LIKE 'Charles Chandler'
) AS `CALCULATE` | moderate | 790 |
Calculate the average height for all superhero. | superhero | average = DIVIDE(SUM(height_cm), COUNT(all heros)); | SELECT
CAST(SUM(`height_cm`) AS DOUBLE) / COUNT(`id`)
FROM `superhero` | simple | 791 |
What is Abomination's superpower? | superhero | Abomination refers to superhero_name = 'Abomination'; superpower refers to power_name; | SELECT
`T3`.`power_name`
FROM `superhero` AS `T1`
INNER JOIN `hero_power` AS `T2`
ON `T1`.`id` = `T2`.`hero_id`
INNER JOIN `superpower` AS `T3`
ON `T2`.`power_id` = `T3`.`id`
WHERE
`T1`.`superhero_name` = 'Abomination' | simple | 792 |
Which hero was the fastest? | superhero | which hero refers to superhero_name; fastest refers to MAX(attribute_value) WHERE attribute_name = 'Speed'; | SELECT `T1`.`superhero_name` FROM `superhero` AS `T1` INNER JOIN `hero_attribute` AS `T2` ON `T1`.`id` = `T2`.`hero_id` INNER JOIN `attribute` AS `T3` ON `T2`.`attribute_id` = `T3`.`id`WHERE `T3`.`attribute_name` = 'Speed' AND `T2`.`attribute_value` = (SELECT MAX(`attribute_value`) FROM `hero_attribute` AS `T2b` WHERE `T2b`.`attribute_id` = `T3`.`id` ) LIMIT 1 | moderate | 794 |
State all of 3-D Man's attributes along with their values. | superhero | 3-D Man is the superhero_name. attributes refers to attribute_name; values refers to attribute_value; | SELECT
`T3`.`attribute_name`,
`T2`.`attribute_value`
FROM `superhero` AS `T1`
INNER JOIN `hero_attribute` AS `T2`
ON `T1`.`id` = `T2`.`hero_id`
INNER JOIN `attribute` AS `T3`
ON `T2`.`attribute_id` = `T3`.`id`
WHERE
`T1`.`superhero_name` = '3-D Man' | moderate | 796 |
Which superheroes have blue eyes with brown hair? | superhero | which superheroes refers to superhero_name; blue eyes refers to color = 'Blue' and color.id = eye_colour_id; brown hair refers to color = 'Brown' and color.id = hair_colour_id; | SELECT
`T1`.`superhero_name`
FROM `superhero` AS `T1`
INNER JOIN `colour` AS `T2`
ON `T1`.`eye_colour_id` = `T2`.`id`
INNER JOIN `colour` AS `T3`
ON `T1`.`hair_colour_id` = `T3`.`id`
WHERE
`T2`.`colour` = 'Blue' AND `T3`.`colour` = 'Brown' | moderate | 797 |
What is the publisher for Hawkman, Karate Kid and Speedy? | superhero | publisher refers to publisher_name; Hawkman refers to superhero_name = 'Hawkman'; Karate Kid refers to superhero_name = 'Karate Kid'; Speedy refers to superhero_name = 'Speedy'; | SELECT
`T2`.`publisher_name`
FROM `superhero` AS `T1`
INNER JOIN `publisher` AS `T2`
ON `T1`.`publisher_id` = `T2`.`id`
WHERE
`T1`.`superhero_name` IN ('Hawkman', 'Karate Kid', 'Speedy') | moderate | 798 |
Calculate the percentage of superheroes with blue eyes. | superhero | percentage = MULTIPLY(DIVIDE(SUM(superhero_name WHERE color = 'Blue'), COUNT(superhero_name)), 100.0); blue eyes refers to color = 'Blue' and color.id = eye_colour_id = 7; | SELECT
CAST(COUNT(CASE WHEN `T2`.`colour` = 'Blue' THEN 1 ELSE NULL END) AS DOUBLE) * 100 / COUNT(`T1`.`id`)
FROM `superhero` AS `T1`
INNER JOIN `colour` AS `T2`
ON `T1`.`eye_colour_id` = `T2`.`id` | moderate | 800 |
Find the ratio between male superheroes and female superheroes. | superhero | ratio = DIVIDE(SUM(gender_id = 1) / SUM(gender_id = 2)); male superheroes refers to gender = 'Female'; female superheroes refers to gender = 'Male'; | SELECT
CAST(COUNT(CASE WHEN `T2`.`gender` = 'Male' THEN `T1`.`id` ELSE NULL END) AS DOUBLE) / COUNT(CASE WHEN `T2`.`gender` = 'Female' THEN `T1`.`id` ELSE NULL END)
FROM `superhero` AS `T1`
INNER JOIN `gender` AS `T2`
ON `T1`.`gender_id` = `T2`.`id` | moderate | 801 |
Provide the eye colour of the superhero who has Karen Beecher-Duncan as their full name. | superhero | eye colour refers to colour.colour where eye_colour_id = colour.id; Karen Beecher-Duncan is the full name of superhero; | SELECT
`T2`.`colour`
FROM `superhero` AS `T1`
INNER JOIN `colour` AS `T2`
ON `T1`.`eye_colour_id` = `T2`.`id`
WHERE
`T1`.`full_name` = 'Karen Beecher-Duncan' | simple | 806 |
In superheroes with missing weight data, calculate the difference between the number of superheroes with blue eyes and no eye color. | superhero | missing weight data refers to weight_kg = 0 OR T1.weight_kg = NULL; difference = SUBTRACT(SUM(colour.id = 7), SUM(colour.id = 1)); blue eyes refers to eye_colour_id WHERE colour.id = 7; no eye color refers to eye_colour_id WHERE colour.id = 1; | SELECT
SUM(CASE WHEN `T2`.`id` = 7 THEN 1 ELSE 0 END) - SUM(CASE WHEN `T2`.`id` = 1 THEN 1 ELSE 0 END)
FROM `superhero` AS `T1`
INNER JOIN `colour` AS `T2`
ON `T1`.`eye_colour_id` = `T2`.`id`
WHERE
`T1`.`weight_kg` = 0 OR `T1`.`weight_kg` IS NULL | challenging | 819 |
How many green-skinned villains are there in the superhero universe? | superhero | green-skinned refers to colour.colour = 'Green' WHERE skin_colour_id = colour.id; villains refers to alignment = 'Bad'; | SELECT
COUNT(`T1`.`id`)
FROM `superhero` AS `T1`
INNER JOIN `alignment` AS `T2`
ON `T1`.`alignment_id` = `T2`.`id`
INNER JOIN `colour` AS `T3`
ON `T1`.`skin_colour_id` = `T3`.`id`
WHERE
`T2`.`alignment` = 'Bad' AND `T3`.`colour` = 'Green' | moderate | 822 |
Identify superheroes who can control wind and list their names in alphabetical order. | superhero | superheroes refers to superhero_name; can control wind refers to power_name = 'Wind Control'; | SELECT
`T1`.`superhero_name`
FROM `superhero` AS `T1`
INNER JOIN `hero_power` AS `T2`
ON `T1`.`id` = `T2`.`hero_id`
INNER JOIN `superpower` AS `T3`
ON `T2`.`power_id` = `T3`.`id`
WHERE
`T3`.`power_name` = 'Wind Control'
ORDER BY
`T1`.`superhero_name` | moderate | 824 |
Identify the gender of the superhero who has the ability of Phoenix Force. | superhero | ability of Phoenix Force refers to power_name = 'Phoenix Force'; | SELECT
`T4`.`gender`
FROM `superhero` AS `T1`
INNER JOIN `hero_power` AS `T2`
ON `T1`.`id` = `T2`.`hero_id`
INNER JOIN `superpower` AS `T3`
ON `T2`.`power_id` = `T3`.`id`
INNER JOIN `gender` AS `T4`
ON `T1`.`gender_id` = `T4`.`id`
WHERE
`T3`.`power_name` = 'Phoenix Force' | moderate | 825 |
Which publisher created more superheroes: DC or Marvel Comics? Find the difference in the number of superheroes. | superhero | DC refers to publisher_name = 'DC Comics'; Marvel Comics refers to publisher_name = 'Marvel Comics'; difference = SUBTRACT(SUM(publisher_name = 'DC Comics'), SUM(publisher_name = 'Marvel Comics')); | SELECT
SUM(CASE WHEN `T2`.`publisher_name` = 'DC Comics' THEN 1 ELSE 0 END) - SUM(CASE WHEN `T2`.`publisher_name` = 'Marvel Comics' THEN 1 ELSE 0 END)
FROM `superhero` AS `T1`
INNER JOIN `publisher` AS `T2`
ON `T1`.`publisher_id` = `T2`.`id` | challenging | 829 |
Which user has a higher reputation, Harlan or Jarrod Dixon? | codebase_community | "Harlan" and "Jarrod Dixon" are both DisplayName; highest reputation refers to Max(Reputation) | SELECT
`DisplayName`
FROM `users`
WHERE
`DisplayName` IN ('Harlan', 'Jarrod Dixon')
AND `Reputation` = (
SELECT
MAX(`Reputation`)
FROM `users`
WHERE
`DisplayName` IN ('Harlan', 'Jarrod Dixon')
) | simple | 531 |
Please list the display names of all the users whose accounts were created in the year 2011. | codebase_community | account created in the year 2011 refers to year(CreationDate) = 2011 | SELECT
`DisplayName`
FROM `users`
WHERE
DATE_FORMAT(CAST(`CreationDate` AS DATETIME), '%Y') = '2011' | simple | 532 |
How many users last accessed the website after 2014/9/1? | codebase_community | last accessed after 2014/9/1 refers to LastAccessDate > '2014-09-01' | SELECT
COUNT(`Id`)
FROM `users`
WHERE
DATE(`LastAccessDate`) > '2014-09-01' | simple | 533 |