db_id
stringclasses
11 values
question
stringlengths
23
286
evidence
stringlengths
0
591
SQL
stringlengths
29
1.45k
question_id
int64
0
1.53k
difficulty
stringclasses
3 values
card_games
Find and list the names of sets which doesn't have Japanese translation but have Korean translation.
names of sets refers to name; doesn't have Japanese translation refers to language not like '%Japanese%'; have Korean translation refers to language = 'Korean'
SELECT name FROM sets WHERE code IN ( SELECT setCode FROM set_translations WHERE language = 'Korean' AND language NOT LIKE '%Japanese%' )
529
moderate
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 T3.lap, T2.name, T2.year, T1.location FROM circuits AS T1 INNER JOIN races AS T2 ON T1.circuitId = T2.circuitId INNER JOIN lapTimes AS T3 ON T3.raceId = T2.raceId ORDER BY T3.lap DESC LIMIT 1
908
simple
formula_1
Which race was Alex Yoong in when he was in track number less than 10?
track number less than 10 refers to position < 10
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 < 10
902
simple
card_games
How many cards are there in the set 'World Championship Decks 2004' with the converted mana cost as '3'.
the set 'World Championship Decks 2004' refers to name = 'World Championship Decks 2004'
SELECT COUNT(id) FROM cards WHERE setCode IN ( SELECT code FROM sets WHERE name = 'World Championship Decks 2004' ) AND convertedManaCost = 3
504
simple
financial
How much is the average amount in credit card made by account holders in a month, in year 2021?
Operation = 'VYBER KARTOU' refers to credit card withdrawn
SELECT AVG(T3.amount) FROM card AS T1 INNER JOIN disp AS T2 ON T1.disp_id = T2.disp_id INNER JOIN trans AS T3 ON T2.account_id = T3.account_id WHERE STRFTIME('%Y', T3.date) = '2021' AND T3.operation = 'VYBER KARTOU'
144
moderate
card_games
Which set is not available outside of the United States and has foil cards with Japanese writing on them? Please include the set ID in your response.
available outside of the United States refers to isForeignOnly = 1; has foil cards refers to isFoilOnly = 1; with Japanese writing on them refers to language = 'Japanese'
SELECT T1.name, T1.id FROM sets AS T1 INNER JOIN set_translations AS T2 ON T1.code = T2.setCode WHERE T2.language = 'Japanese' AND T1.isFoilOnly = 1 AND T1.isForeignOnly = 0
431
challenging
toxicology
List the elements of all the triple bonds.
triple bond refers to bond_type = '#'; element = 'cl' means Chlorine; element = 'c' means Carbon; element = 'h' means Hydrogen; element = 'o' means Oxygen, element = 's' means Sulfur; element = 'n' means Nitrogen, element = 'p' means Phosphorus, element = 'na' means Sodium, element = 'br' means Bromine, element = 'f' means Fluorine; element = 'i' means Iodine; element = 'sn' means Tin; element = 'pb' means Lead; element = 'te' means Tellurium; element = 'ca' means Calcium
SELECT DISTINCT T3.element FROM bond AS T1 INNER JOIN connected AS T2 ON T1.bond_id = T2.bond_id INNER JOIN atom AS T3 ON T2.atom_id = T3.atom_id WHERE T1.bond_type = '#'
253
challenging
thrombosis_prediction
What was the age of the youngest patient when they initially arrived at the hospital?
age refers to SUBTRACT(YEAR(Birthday), YEAR(`First Date`))
SELECT MIN(STRFTIME('%Y', `First Date`) - STRFTIME('%Y', Birthday)) FROM Patient
1,163
simple
superhero
Name the tallest superhero.
tallest superhero refers to MAX(height_cm);
SELECT superhero_name FROM superhero ORDER BY height_cm DESC LIMIT 1
832
simple
formula_1
Please list the positions of the circuits built by the constructor Renault.
Renault is a name of constructor;
SELECT DISTINCT T1.position FROM constructorStandings AS T1 INNER JOIN constructors AS T2 ON T2.constructorId = T1.constructorId WHERE T2.name = 'Renault'
851
simple
formula_1
For all the drivers who finished the game in race No. 592, who is the oldest?
drivers who finished the race refers to time is not empty; oldest driver refers to oldest dob;
SELECT T1.forename, T1.surname FROM drivers AS T1 INNER JOIN results AS T2 ON T2.driverId = T1.driverId WHERE T2.raceId = 592 AND T2.time IS NOT NULL AND T1.dob IS NOT NULL ORDER BY T1.dob ASC LIMIT 1
865
moderate
debit_card_specializing
What is the highest monthly consumption in the year 2012?
The first 4 strings of yearmonth.date can represent the year.
SELECT SUM(Consumption) FROM yearmonth WHERE SUBSTRING(Date, 1, 4) = '2012' GROUP BY SUBSTRING(Date, 5, 2) ORDER BY SUM(Consumption) DESC LIMIT 1
1,498
simple
toxicology
Of the first 100 molecules in number order, how many are carcinogenic?
first 100 molecules in number order refers to molecule_id between 'TR000' and 'TR099'; label = '+' means molecules are carcinogenic
SELECT COUNT(T.molecule_id) FROM molecule AS T WHERE molecule_id BETWEEN 'TR000' AND 'TR099' AND T.label = '+'
204
simple
formula_1
Where can the introduction of the races held on Circuit de Barcelona-Catalunya be found?
introduction of races refers to url; Circuit de Barcelona-Catalunya is a name of circuit;
SELECT DISTINCT T1.url FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T1.name = 'Circuit de Barcelona-Catalunya'
849
simple
card_games
What are the cards belong to duel deck a? List the ID.
duel deck a refers to duelDeck = a;
SELECT id FROM cards WHERE duelDeck = 'a'
379
simple
california_schools
In Los Angeles how many schools have more than 500 free meals but less than 700 free or reduced price meals for K-12?
SELECT COUNT(CDSCode) FROM frpm WHERE `County Name` = 'Los Angeles' AND `Free Meal Count (K-12)` > 500 AND `Free Meal Count (K-12)` < 700
21
simple
debit_card_specializing
What is the average total price of the transactions taken place in January, 2012?
In January, 2012 means Date contains '2012-01'
SELECT AVG(Amount) FROM transactions_1k WHERE Date LIKE '2012-01%'
1,504
simple
california_schools
Please list the lowest three eligible free rates for students aged 5-17 in continuation schools.
Eligible free rates for students aged 5-17 = `Free Meal Count (Ages 5-17)` / `Enrollment (Ages 5-17)`
SELECT `Free Meal Count (Ages 5-17)` / `Enrollment (Ages 5-17)` FROM frpm WHERE `Educational Option Type` = 'Continuation School' AND `Free Meal Count (Ages 5-17)` / `Enrollment (Ages 5-17)` IS NOT NULL ORDER BY `Free Meal Count (Ages 5-17)` / `Enrollment (Ages 5-17)` ASC LIMIT 3
1
moderate
financial
How many owner and disponent dispositions are there from account number 1 to account number 10?
SELECT SUM(type = 'Owner') , SUM(type = 'Disponent') FROM disp WHERE account_id BETWEEN 1 AND 10
172
simple
financial
What are the accounts that have both gold and junior credit cards?
SELECT T2.account_id FROM card AS T1 INNER JOIN disp AS T2 ON T1.disp_id = T2.disp_id WHERE T1.type IN ('gold', 'junior')
143
simple
california_schools
What is the city location of the high school level school with Lunch Provision 2 whose lowest grade is 9 and the highest grade is 12 in the county of Merced?
High school can be represented as EILCode = 'HS'
SELECT T2.City FROM frpm AS T1 INNER JOIN schools AS T2 ON T1.CDSCode = T2.CDSCode WHERE T1.`NSLP Provision Status` = 'Lunch Provision 2' AND T2.County = 'Merced' AND T1.`Low Grade` = 9 AND T1.`High Grade` = 12 AND T2.EILCode = 'HS'
76
moderate
toxicology
Which bond ids are double-bond with carcinogenic compound?
label = '+' mean molecules are carcinogenic; double bond refers to bond_type = ' = ';
SELECT T1.bond_id FROM bond AS T1 INNER JOIN molecule AS T2 ON T1.molecule_id = T2.molecule_id WHERE T2.label = '+' AND T1.bond_type = '='
294
simple
card_games
What is the number of cards are there in the set of "Rinascita di Alara"?
number of cards refers to baseSetSize; set of "Rinascita di Alara" refers to translation = 'Rinascita di Alara'
SELECT T1.baseSetSize FROM sets AS T1 INNER JOIN set_translations AS T2 ON T2.setCode = T1.code WHERE T2.translation = 'Rinascita di Alara'
496
simple
thrombosis_prediction
List ID, sex and date of birth of patient whose total protein (TP) below the lower range of the normal index.
total protein (TP) below the lower range of the normal index refers to TP < 6.0
SELECT DISTINCT T1.ID, T1.SEX, T1.Birthday FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.TP < 6.0
1,214
simple
formula_1
Name the first race recorded. What are the other races that happened within the same month and year of that race.
the first race refers to year = year(min(date)) and month = month(min(date));
SELECT name FROM races WHERE STRFTIME('%Y', date) = ( SELECT STRFTIME('%Y', date) FROM races ORDER BY date ASC LIMIT 1 ) AND STRFTIME('%m', date) = ( SELECT STRFTIME('%m', date) FROM races ORDER BY date ASC LIMIT 1 )
884
moderate
codebase_community
Please list all display names of users who are adults.
adults refer to users where Age BETWEEN 19 and 65;
SELECT DisplayName FROM users WHERE Age BETWEEN 19 AND 65
676
simple
codebase_community
What is the display name of the user who acquired the first Autobiographer badge?
Autobiographer is the name of the badge; acquired the first refers to MIN(Date);
SELECT T1.DisplayName FROM users AS T1 INNER JOIN badges AS T2 ON T1.Id = T2.UserId WHERE T2.`Name` = 'Autobiographer' ORDER BY T2.Date LIMIT 1
671
simple
debit_card_specializing
What was the gas consumption peak month for SME customers in 2013?
'in 2013' refers to the first 4 strings of yearmonth.date = '2013', The 5th and 6th string of the date can refer to month.
SELECT SUBSTRING(T2.Date, 5, 2) FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE SUBSTRING(T2.Date, 1, 4) = '2013' AND T1.Segment = 'SME' GROUP BY SUBSTRING(T2.Date, 5, 2) ORDER BY SUM(T2.Consumption) DESC LIMIT 1
1,480
moderate
european_football_2
Please state the finishing rate and curve score of the player who has the heaviest weight.
heaviest weight refers to MAX(weight)
SELECT id, finishing, curve FROM Player_Attributes WHERE player_api_id = ( SELECT player_api_id FROM Player ORDER BY weight DESC LIMIT 1 ) LIMIT 1
1,144
simple
european_football_2
State 10 names of the strongest players.
strongest players refers to MAX(overall_rating)
SELECT DISTINCT t1.player_name FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_api_id = t2.player_api_id ORDER BY t2.overall_rating DESC LIMIT 10
1,122
simple
toxicology
What type of label is not on molecules with atoms with tin?
tin refers to element ! = 'sn'; label = '+' mean molecules are carcinogenic; label = '-' means molecules are non-carcinogenic
SELECT DISTINCT T2.label FROM atom AS T1 INNER JOIN molecule AS T2 ON T1.molecule_id = T2.molecule_id WHERE T1.element != 'sn'
214
simple
european_football_2
List the name of leagues in which the average goals by the home team is higher than the away team in the 2009/2010 season.
name of league refers to League.name; average goals by the home team is higher than the away team = AVG(home_team_goal) > AVG(away_team_goal);
SELECT t1.name FROM League AS t1 INNER JOIN Match AS t2 ON t1.id = t2.league_id WHERE t2.season = '2009/2010' GROUP BY t1.name HAVING (CAST(SUM(t2.home_team_goal) AS REAL) / COUNT(DISTINCT t2.id)) - (CAST(SUM(t2.away_team_goal) AS REAL) / COUNT(DISTINCT t2.id)) > 0
1,042
challenging
codebase_community
What is the owner's display name of the most popular post?
Higher view count means the post has higher popularity; the most popular post refers to MAX(ViewCount);
SELECT DisplayName FROM users WHERE Id = ( SELECT OwnerUserId FROM posts ORDER BY ViewCount DESC LIMIT 1 )
653
simple
california_schools
What is the administrator's last name that oversees the school with Charter number 40? Indicate the district, the county where the school is situated, and the name of the school.
SELECT AdmLName1, District, County, School FROM schools WHERE CharterNum = '0040'
86
simple
student_club
List the last name of all the students who majored Law and Constitutional Studies.
'Law and Constitutional Studies' is the major name
SELECT T1.last_name FROM member AS T1 INNER JOIN major AS T2 ON T1.link_to_major = T2.major_id WHERE T2.major_name = 'Law and Constitutional Studies'
1,328
simple
student_club
What is the average amount paid by students in a position other than a member?
position other than a member refers to position ! = 'Member'; average amount paid = DIVIDE( SUM(cost), COUNT(event_id))
SELECT AVG(T1.cost) FROM expense AS T1 INNER JOIN member as T2 ON T1.link_to_member = T2.member_id WHERE T2.position != 'Member'
1,452
moderate
codebase_community
Give the texts commented on the post about linear regression.
Title = 'How can I adapt ANOVA for binary data?';
SELECT T1.Text FROM comments AS T1 INNER JOIN posts AS T2 ON T1.PostId = T2.Id WHERE T2.Title LIKE '%linear regression%'
706
simple
student_club
What's Christof Nielson's zip code type?
SELECT T2.type FROM member AS T1 INNER JOIN zip_code AS T2 ON T1.zip = T2.zip_code WHERE T1.first_name = 'Christof' AND T1.last_name = 'Nielson'
1,353
simple
formula_1
During which lap did Lewis Hamilton take a pit stop during the 2011 Australian Grand Prix?
SELECT T1.lap FROM pitStops AS T1 INNER JOIN drivers AS T2 on T1.driverId = T2.driverId INNER JOIN races AS T3 on T1.raceId = T3.raceId WHERE T2.forename = 'Lewis' AND T2.surname = 'Hamilton' AND T3.year = 2011 AND T3.name = 'Australian Grand Prix'
1,008
simple
codebase_community
How many tags have post count between 5,000 to 7,000?
post count between 5,000 to 7,000 refers to Count BETWEEN 5000 and 7000;
SELECT COUNT(Id) FROM tags WHERE Count BETWEEN 5000 AND 7000
659
simple
european_football_2
Which player is older, Aaron Lennon or Abdelaziz Barrada?
older player refers to older birthday;
SELECT player_name FROM Player WHERE player_name IN ('Aaron Lennon', 'Abdelaziz Barrada') ORDER BY birthday ASC LIMIT 1
1,078
simple
card_games
How many cards of legalities whose status is restricted have text boxes?
restricted refers to status = 'restricted'; have text boxes refers to is Textless = 0;
SELECT COUNT(DISTINCT T1.id) FROM cards AS T1 INNER JOIN legalities AS T2 ON T1.uuid = T2.uuid WHERE T2.status = 'Restricted' AND T1.isTextless = 0
361
simple
european_football_2
What is the average number of goals made by Parma as the away team while playing in Italy?
Parma refers to team_long_name = 'Parma'; average number of goals refers to AVG(away_team_goal)
SELECT CAST(SUM(T1.away_team_goal) AS REAL) / COUNT(T1.id) FROM "Match" AS T1 INNER JOIN TEAM AS T2 ON T1.away_team_api_id = T2.team_api_id INNER JOIN Country AS T3 ON T1.country_id = T3.id WHERE T2.team_long_name = 'Parma' AND T3.name = 'Italy'
1,101
moderate
card_games
List all the sets available in Italian translation. State the total number of cards per set.
Italian translation refers to language = 'Italian'; total number of card per set refers to totalSetSize;
SELECT T1.name, T1.totalSetSize FROM sets AS T1 INNER JOIN set_translations AS T2 ON T1.code = T2.setCode WHERE T2.language = 'Italian'
353
simple
financial
How many of the account holders in South Bohemia still do not own credit cards?
A3 contains the region names; South Bohemia is one of region names.
SELECT COUNT(T3.account_id) FROM district AS T1 INNER JOIN client AS T2 ON T1.district_id = T2.district_id INNER JOIN disp AS T3 ON T2.client_id = T3.client_id WHERE T1.A3 = 'south Bohemia' AND T3.type != 'OWNER'
130
moderate
thrombosis_prediction
For the patient with an abnormal alkaliphophatase level, how many of them are admitted to the hospital?
abnormal alkaliphophatase level refers to ALP > = 300; admitted to the hospital refers to Admission = '+';
SELECT COUNT(T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.ALP >= 300 AND T1.Admission = '+'
1,286
simple
codebase_community
Identify the number of posts that offer a bounty amount over 30.
bounty amount over 30 refers to BountyAmount > = 30;
SELECT COUNT(id) FROM votes WHERE BountyAmount >= 30
700
simple
thrombosis_prediction
Provide all ID, sex and birthday of patients whose urea nitrogen (UN) just within the borderline of passing?
urea nitrogen (UN) just within the borderline of passing refers to UN = 29
SELECT DISTINCT T1.ID, T1.SEX, T1.Birthday FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.UN = 29
1,220
simple
student_club
List all of the College of Humanities and Social Sciences' departments.
SELECT department FROM major WHERE college = 'College of Humanities and Social Sciences'
1,363
simple
european_football_2
Which country is the league Italy Serie A from?
Italy Serie A from refers to League.name = 'Italy Serie A';
SELECT t1.name FROM Country AS t1 INNER JOIN League AS t2 ON t1.id = t2.country_id WHERE t2.name = 'Italy Serie A'
1,070
simple
formula_1
What was the longest time that Lewis Hamilton had spent at a pit stop?
longest time refes to MAX(duration);
SELECT T1.duration FROM pitStops AS T1 INNER JOIN drivers AS T2 on T1.driverId = T2.driverId WHERE T2.forename = 'Lewis' AND T2.surname = 'Hamilton' ORDER BY T1.duration DESC LIMIT 1
1,007
simple
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 IS NOT NULL) DESC LIMIT 1
979
simple
thrombosis_prediction
What was the gender of the first AORTITIS diagnosed patient?
gender means SEX; 'AORTITIS' refers to Diagnosis;
SELECT SEX FROM Patient WHERE Diagnosis = 'AORTITIS' AND `First Date` IS NOT NULL ORDER BY `First Date` ASC LIMIT 1
1,178
simple
european_football_2
Give the name of the league with the highest matches of all time and how many matches were played in the said league.
name of the league refers to League.name; league with highest matches of all time refers to MAX(COUNT(league_id));
SELECT t2.name, COUNT(t1.id) FROM Match AS t1 INNER JOIN League AS t2 ON t1.league_id = t2.id GROUP BY t2.name ORDER BY COUNT(t1.id) DESC LIMIT 1
1,032
moderate
superhero
How many superheroes are published by Marvel Comics?
published by Marvel Comics 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 WHERE T2.publisher_name = 'Marvel Comics'
725
simple
toxicology
In the non-carcinogenic molecules, how many contain chlorine atoms?
non-carcinogenic molecules refers to label = '-'; chlorine atoms refers to element = 'cl'
SELECT COUNT(DISTINCT T1.molecule_id) FROM molecule AS T1 INNER JOIN atom AS T2 ON T1.molecule_id = T2.molecule_id WHERE T2.element = 'cl' AND T1.label = '-'
196
simple
thrombosis_prediction
Among the patients whose C-reactive protein level is abnormal, how many of them aren't 18 yet?
C-reactive protein level is abnormal refers to CRP NOT IN('+-', '-') AND CRP > = 1.0; aren't 18 refers = CRP > = 1.0 AND SUBTRACT((YEAR(CURDATE()), YEAR(Birthday))) < 18; Should compute the number of distinct ones.
SELECT COUNT(DISTINCT T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE (T2.CRP != '-' AND T2.CRP != '+-') AND T2.CRP >= 1.0 AND STRFTIME('%Y', Date('now')) - STRFTIME('%Y', T1.Birthday) < '18'
1,257
challenging
codebase_community
For the post that got the most number of answers owned by csgillespie, how many answers did it get?
"csgillespie" is the DisplayName of user; the most number of answer refers to Max(AnswerCount)
SELECT MAX(T1.AnswerCount) FROM posts AS T1 INNER JOIN users AS T2 ON T1.OwnerUserId = T2.Id WHERE T2.DisplayName = 'csgillespie'
543
simple
superhero
Calculate the percentage of superheroes with blue eyes.
percentage = MULTIPLY(DIVIDE(SUM(superhero_name WHERE eye_colour_id = 7), COUNT(superhero_name)), 100.0); blue eyes refers to eye_colour_id = 7;
SELECT CAST(COUNT(CASE WHEN T2.colour = 'Blue' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.id) FROM superhero AS T1 INNER JOIN colour AS T2 ON T1.eye_colour_id = T2.id
800
moderate
card_games
For artifact type of cards that do not have multiple faces on the same card, state its legalities for vintage play format.
Artifact type of cards refers to types = 'Artifact'; card does not have multiple faces on the same card refers to side is NULL'; vintage play format refers to format = 'vintage';
SELECT DISTINCT T2.status FROM cards AS T1 INNER JOIN legalities AS T2 ON T1.uuid = T2.uuid WHERE T1.type = 'Artifact' AND T2.format = 'vintage' AND T1.side IS NULL
345
moderate
toxicology
List down the molecule id for non carcinogenic molecules.
label = '-' means molecules are non-carcinogenic
SELECT T.molecule_id FROM molecule AS T WHERE T.label = '-'
265
simple
formula_1
Where is Malaysian Grand Prix held? Give the location coordinates.
coordinates refers to (lat, lng);
SELECT DISTINCT T1.lat, T1.lng FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T2.name = 'Malaysian Grand Prix'
868
simple
card_games
Please provide top three sets that don't appear in Magic: The Gathering Online, along with their names in in alphabetical order.
don't appear in Magic: The Gathering Online refers to mtgoCode is NULL or mtgoCode = ''
SELECT name FROM sets WHERE mtgoCode IS NULL ORDER BY name LIMIT 3
426
simple
superhero
Provide superheroes' names who have the adaptation power.
adaptation power refers to power_name = 'Adaptation';
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 = 'Adaptation'
778
simple
card_games
What is percentage of the cards with a converted Mana Cost of 10 in set of Abyssal Horror?
set of Abyssal Horror refers to name = 'Abyssal Horror'; percentage refers to DIVIDE(COUNT(convertedManaCost = 16),COUNT(convertedManaCost))*100
SELECT CAST(SUM(CASE WHEN T1.convertedManaCost = 10 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.id), T1.name FROM cards AS T1 INNER JOIN sets AS T2 ON T2.code = T1.setCode WHERE T1.name = 'Abyssal Horror'
446
moderate
superhero
Who is the publisher of Sauron?
the publisher refers to publisher_name; Sauron refers to superhero_name = 'Sauron'
SELECT T2.publisher_name FROM superhero AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.id WHERE T1.superhero_name = 'Sauron'
727
simple
student_club
How many cities are there in Orange County, Virginia?
Orange County is the county, Virginia is the state
SELECT COUNT(city) FROM zip_code WHERE county = 'Orange County' AND state = 'Virginia'
1,362
simple
superhero
Which publisher created more superheroes: DC or Marvel Comics? Find the difference in the number of superheroes.
DC refers to publisher_name = 'DC Comics'; Marvel Comics refers to publisher_name = 'Marvel Comics'; if SUM(publisher_name = 'DC Comics') > SUM(publisher_name = 'Marvel Comics'), it means DC Comics published more superheroes than Marvel Comics; if SUM(publisher_name = 'Marvel Comics') > SUM(publisher_name = 'Marvel Comics'), it means Marvel Comics published more heroes than DC 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
829
challenging
european_football_2
List all the football player with the highest balance score and potential score of 61.
balance score refers to balance; highest balance score refers to MAX(balance); potential score refers to potential; potential = 61;
SELECT t1.player_name FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_api_id = t2.player_api_id WHERE t2.potential = '61' ORDER BY t2.balance DESC LIMIT 1
1,075
moderate
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 LIMIT 1
958
moderate
superhero
Which publisher published the slowest 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
732
moderate
codebase_community
How many users are awarded with more than 5 badges?
more than 5 badges refers to Count (Name) > 5; user refers to UserId
SELECT UserId FROM ( SELECT UserId, COUNT(Name) AS num FROM badges GROUP BY UserId ) T WHERE T.num > 5
592
simple
debit_card_specializing
For the customer who paid 124.05 in 2012/8/24, how much did he/she spend during the January of 2012? And what is the date and expenses exactly?
'2012/8/24' can be represented by '2012-08-24'; expense and the consumption has the similar meaning.
SELECT T1.CustomerID, T2.Date, T2.Consumption FROM transactions_1k AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Date = '2012-08-24' AND T1.Price = 124.05 AND T2.Date = '201201'
1,520
moderate
superhero
What is the superpower of hero ID 56?
superpower refers to hero_power
SELECT T2.power_name FROM hero_power AS T1 INNER JOIN superpower AS T2 ON T1.power_id = T2.id WHERE T1.hero_id = 56
754
simple
superhero
What is the hero's full name with the highest attribute in strength?
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
766
moderate
formula_1
In the race a driver set the lap record for the Austrian Grand Prix Circuit, how long did he spent at the pit stop at that same race?
lap record means the fastest time recorded which refers to time, how long spent at pitstop refers to duration
WITH fastest_lap_times AS ( SELECT T1.raceId, T1.driverId, T1.FastestLapTime, (CAST(SUBSTR(T1.FastestLapTime, 1, INSTR(T1.FastestLapTime, ':') - 1) AS REAL) * 60) + (CAST(SUBSTR(T1.FastestLapTime, INSTR(T1.FastestLapTime, ':') + 1, INSTR(T1.FastestLapTime, '.') - INSTR(T1.FastestLapTime, ':') - 1) AS REAL)) + (CAST(SUBSTR(T1.FastestLapTime, INSTR(T1.FastestLapTime, '.') + 1) AS REAL) / 1000) as time_in_seconds FROM results AS T1 WHERE T1.FastestLapTime IS NOT NULL), lap_record_race AS ( SELECT T1.raceId, T1.driverId 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 T2.name = 'Austrian Grand Prix') AS T4 ON (CAST(SUBSTR(T1.FastestLapTime, 1, INSTR(T1.FastestLapTime, ':') - 1) AS REAL) * 60) + (CAST(SUBSTR(T1.FastestLapTime, INSTR(T1.FastestLapTime, ':') + 1, INSTR(T1.FastestLapTime, '.') - INSTR(T1.FastestLapTime, ':') - 1) AS REAL)) + (CAST(SUBSTR(T1.FastestLapTime, INSTR(T1.FastestLapTime, '.') + 1) AS REAL) / 1000) = T4.min_time_in_seconds WHERE T2.name = 'Austrian Grand Prix') SELECT T4.duration FROM lap_record_race INNER JOIN pitStops AS T4 on lap_record_race.raceId = T4.raceId AND lap_record_race.driverId = T4.driverId
1,016
challenging
toxicology
What is the element of toxicology for the atom with the ID of TR000_1?
atom with ID refers to atom_id; element = 'cl' means Chlorine; element = 'c' means Carbon; element = 'h' means Hydrogen; element = 'o' means Oxygen, element = 's' means Sulfur; element = 'n' means Nitrogen, element = 'p' means Phosphorus, element = 'na' means Sodium, element = 'br' means Bromine, element = 'f' means Fluorine; element = 'i' means Iodine; element = 'sn' means Tin; element = 'pb' means Lead; element = 'te' means Tellurium; element = 'ca' means Calcium
SELECT T.element FROM atom AS T WHERE T.atom_id = 'TR000_1'
322
challenging
formula_1
Name all drivers in the 2010 Singapore Grand Prix order by their position stands.
SELECT T3.forename, T3.surname FROM races AS T1 INNER JOIN driverStandings AS T2 ON T2.raceId = T1.raceId INNER JOIN drivers AS T3 ON T3.driverId = T2.driverId WHERE T1.name = 'Singapore Grand Prix' AND T1.year = 2010 ORDER BY T2.position ASC
891
simple
card_games
Which of these artists have designed a card in the set Coldsnap, Jeremy Jarvis, Aaron Miller or Chippy?
card set Coldsnap refers to name = 'Coldsnap'; Jeremy Jarvis, Aaron Miller or Chippy are the name of artists which refers to artist IN ('Jeremy Jarvis', 'Aaron Miller','Chippy');
SELECT T1.artist FROM cards AS T1 INNER JOIN sets AS T2 ON T2.code = T1.setCode WHERE (T2.name = 'Coldsnap' AND T1.artist = 'Chippy') OR (T2.name = 'Coldsnap' AND T1.artist = 'Aaron Miller') OR (T2.name = 'Coldsnap' AND T1.artist = 'Jeremy Jarvis') GROUP BY T1.artist
477
challenging
codebase_community
Identify the number of adult users who have cast over 5000 upvotes.
adult users refer to Age BETWEEN 19 and 65; over 5000 upvotes refer to UpVotes > 5000;
SELECT COUNT(Id) FROM users WHERE Age BETWEEN 19 AND 65 AND UpVotes > 5000
691
simple
debit_card_specializing
Which year recorded the most gas use paid in EUR?
SELECT SUBSTRING(T2.Date, 1, 4) FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Currency = 'EUR' GROUP BY SUBSTRING(T2.Date, 1, 4) ORDER BY SUM(T2.Consumption) DESC LIMIT 1
1,477
simple
card_games
How many cards have frame effect as extendedart? List out the id of those cards.
frame effect as extendedart refers to frameEffects = 'extendedart'
SELECT id FROM cards WHERE frameEffects = 'extendedart' GROUP BY id
436
simple
codebase_community
How many posts with votes that were created in 2011 have a bounty of 50?
created in 2012 refers YEAR(CreationDate) = 2011; BountyAmount = 50;
SELECT COUNT(T1.Id) FROM posts AS T1 INNER JOIN votes AS T2 ON T1.Id = T2.PostId WHERE T2.BountyAmount = 50 AND STRFTIME('%Y', T2.CreationDate) = '2011'
662
simple
thrombosis_prediction
For the male patients that have a normal prothrombin time, what is their average prothrombin time?
male refers to Sex = 'M'; normal prothrombin time refer to PT < 14; average prothrombin time = AVG(PT);
SELECT AVG(T2.PT) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.PT < 14 AND T1.SEX = 'M'
1,310
simple
financial
How much, in total, did client number 617 pay for all of the transactions in 1998?
SELECT SUM(T3.amount) FROM client AS T1 INNER JOIN account AS T2 ON T1.district_id = T2.district_id INNER JOIN trans AS T3 ON T2.account_id = T3.account_id WHERE STRFTIME('%Y', T3.date)= '1998' AND T1.client_id = 617
179
simple
card_games
Is the set of cards with Adarkar Valkyrie only available outside the United States?
card set Adarkar Valkyrie refers to name = 'Adarkar Valkyrie'; isForeignOnly = 1 means only available outside the United States;
SELECT IIF(isForeignOnly = 1, 'YES', 'NO') FROM cards AS T1 INNER JOIN sets AS T2 ON T2.code = T1.setCode WHERE T1.name = 'Adarkar Valkyrie'
473
moderate
toxicology
How many bonds are created by bonding atoms with chlorine element?
chlorine refers to element = 'cl'
SELECT COUNT(T1.bond_id) FROM connected AS T1 INNER JOIN atom AS T2 ON T1.atom_id = T2.atom_id WHERE T2.element = 'cl'
308
simple
codebase_community
What is the excerpt post ID and wiki post ID of the tag named sample?
tag named sample refers to TagName = 'sample';
SELECT ExcerptPostId, WikiPostId FROM tags WHERE TagName = 'sample'
704
simple
formula_1
Calculate the percentage whereby Hamilton was not at the 1st track of the the f1 circuit since 2010.
DIVIDE(COUNT(raceId) where surname = 'Hamilton', year >= 2010 and position>1), (COUNT(raceId) where surname = 'Hamilton', year >= 2010) as percentage;
SELECT CAST(COUNT(CASE WHEN T2.position <> 1 THEN T2.position END) AS REAL) * 100 / COUNT(T2.driverStandingsId) FROM races AS T1 INNER JOIN driverStandings AS T2 ON T2.raceId = T1.raceId INNER JOIN drivers AS T3 ON T3.driverId = T2.driverId WHERE T3.surname = 'Hamilton' AND T1.year >= 2010
896
challenging
european_football_2
List all the football player with the highest potential score.
potential score refers to potential; highest potential score refers to MAX(potential);
SELECT DISTINCT(t1.player_name) FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_api_id = t2.player_api_id WHERE t2.potential = (SELECT MAX(potential) FROM Player_Attributes)
1,051
simple
california_schools
What is the average score in writing for the schools that were opened after 1991 or closed before 2000? List the school names along with the score. Also, list the communication number of the schools if there is any.
Communication number refers to phone number.
SELECT T2.School, T1.AvgScrWrite, T2.Phone, strftime('%Y', T2.OpenDate), strftime('%Y', T2.ClosedDate) FROM schools AS T2 LEFT JOIN satscores AS T1 ON T2.CDSCode = T1.cds WHERE strftime('%Y', T2.OpenDate) > '1991' AND strftime('%Y', T2.ClosedDate) < '2000'
27
moderate
card_games
Among the card designed by Matthew D. Wilson, how many are available only in the paper?
card designed by Matthew D. Wilson refers to artist = 'Matthew D. Wilson'; available only in the paper refers to availability = 'paper'
SELECT COUNT(id) FROM cards WHERE artist = 'Matthew D. Wilson' AND availability = 'paper'
526
simple
thrombosis_prediction
Among the patients who has a normal anti-scl70, how many of them are male and have the symptom of vertigo?
normal anti-scl70 refers to SC170 IN('-', '+-'); male refers to Sex = 'M'; symptom of vertigo refers to symptoms = 'vertigo'; Should compute the number of distinct ones
SELECT COUNT(DISTINCT T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID INNER JOIN Examination AS T3 ON T3.ID = T2.ID WHERE (T2.SC170 = '-' OR T2.SC170 = '+-') AND T1.SEX = 'M' AND T3.Symptoms = 'vertigo'
1,270
challenging
superhero
List down at least five superpowers of male superheroes.
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
751
moderate
codebase_community
How many adults who obtained the badge Supporter?
Supporter is the Name of badge; adult refers to Age BETWEEN 19 AND 65
SELECT COUNT(T1.Id) FROM users AS T1 INNER JOIN badges AS T2 ON T1.Id = T2.UserId WHERE T2.Name = 'Supporter' AND T1.Age BETWEEN 19 AND 65
619
simple
card_games
What is the percentage of cards whose language is French among the Story Spotlight cards?
Story Spotlight card refers to isStorySpotlight = 1; French is the language; Percentage = Divide(Count(id) where language = 'French' and isStorySpotlight = 1, Count(id) where isStorySpotlight = 1)*100
SELECT CAST(SUM(CASE WHEN T2.language = 'French' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.id) FROM cards AS T1 INNER JOIN foreign_data AS T2 ON T1.uuid = T2.uuid WHERE T1.isStorySpotlight = 1
371
challenging
european_football_2
What is the ADO Den Haag team freedom of movement in the 1st two thirds of the pitch?
ADO Den Haag refers to team_long_name = 'ADO Den Haag'; freedom of movement in the 1st two thirds of the pitch refers to buildUpPlayPositioningClass;
SELECT DISTINCT t2.buildUpPlayPositioningClass FROM Team AS t1 INNER JOIN Team_attributes AS t2 ON t1.team_fifa_api_id = t2.team_fifa_api_id WHERE t1.team_long_name = 'ADO Den Haag'
1,046
moderate
debit_card_specializing
What was the difference in gas consumption between CZK-paying customers and EUR-paying customers in 2012?
Year 2012 can be presented as Between 201201 And 201212, which means between January and December in 2012; Difference in Consumption = CZK customers consumption in 2012 - EUR customers consumption in 2012
SELECT SUM(IIF(T1.Currency = 'CZK', T2.Consumption, 0)) - SUM(IIF(T1.Currency = 'EUR', T2.Consumption, 0)) FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE SUBSTRING(T2.Date, 1, 4) = '2012'
1,476
challenging
student_club
Calculate the total average cost that Elijah Allen spent in the events on September and October.
events in September and October refers to month(expense_date) = 9 AND MONTH(expense_date) = 10
SELECT AVG(T2.cost) FROM member AS T1 INNER JOIN expense AS T2 ON T1.member_id = T2.link_to_member WHERE T1.last_name = 'Allen' AND T1.first_name = 'Elijah' AND (SUBSTR(T2.expense_date, 6, 2) = '09' OR SUBSTR(T2.expense_date, 6, 2) = '10')
1,339
challenging
california_schools
Please provide the National Center for Educational Statistics school district identification number for all schools with a School Ownership Code that are part of the State Special Schools.
State Special Schools means that SOC = 31.
SELECT NCESDist FROM schools WHERE SOC = 31
69
simple