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
codebase_community
Who has the highest reputation? Please give the display name.
the highest reputation refers to MAX(Reputation);
SELECT DisplayName FROM users WHERE Reputation = ( SELECT MAX(Reputation) FROM users )
674
simple
card_games
Among the sets whose expansion type is Commander, which set has the highest total number of cards including promotional and related supplemental products but excluding Alchemy modifications? Indicate the id of the set.
expansion type refers to type where type = 'commander'; totalSetSize: The total number of cards in the set, including promotional and related supplemental products but excluding Alchemy modifications; highest total number of cards refers to MAX(totalSetSize)
SELECT id FROM sets WHERE type = 'commander' ORDER BY totalSetSize DESC LIMIT 1
513
challenging
financial
How many clients who were born in 1920 stay in east Bohemia?
East Bohemia appears in the column A3, which refers to the region.
SELECT COUNT(T1.client_id) FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE STRFTIME('%Y', T1.birth_date) = '1920' AND T2.A3 = 'east Bohemia'
190
simple
toxicology
What is the molecule id of bond id TR001_1_7?
SELECT DISTINCT T1.molecule_id FROM atom AS T1 INNER JOIN connected AS T2 ON T1.atom_id = T2.atom_id WHERE T2.bond_id = 'TR001_1_7'
318
simple
card_games
How many cards with original type of "Summon - Angel" have subtype other than "Angel"?
subtype other than Angel refers to subtypes is not 'Angel';
SELECT COUNT(id) FROM cards WHERE originalType = 'Summon - Angel' AND subtypes != 'Angel'
377
simple
card_games
How many cards with unknown power that can't be found in foil is in duel deck A?
unknown power refers to power IS NULL or power = '*'; can't be found in foil refers to hasFoil = 0; duel deck A refers to duelDeck = 'a'
SELECT SUM(CASE WHEN power LIKE '%*%' OR power IS NULL THEN 1 ELSE 0 END) FROM cards WHERE hasFoil = 0 AND duelDeck = 'a'
512
simple
codebase_community
Write all comments made on the post titled 'How does gentle boosting differ from AdaBoost?'
"How does gentle boosting differ from AdaBoost?" is the Title of post; comments refers to Text
SELECT T1.Text FROM comments AS T1 INNER JOIN posts AS T2 ON T1.PostId = T2.Id WHERE T2.Title = 'How does gentle boosting differ from AdaBoost?'
579
simple
toxicology
What are the elements for bond id TR001_10_11?
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 T2.element FROM connected AS T1 INNER JOIN atom AS T2 ON T1.atom_id = T2.atom_id WHERE T1.bond_id = 'TR001_10_11'
268
challenging
debit_card_specializing
In February 2012, what percentage of customers consumed more than 528.3?
February 2012 refers to '201202' in yearmonth.date
SELECT CAST(SUM(IIF(Consumption > 528.3, 1, 0)) AS FLOAT) * 100 / COUNT(CustomerID) FROM yearmonth WHERE Date = '201202'
1,493
simple
card_games
What is the foreign name of the card in French of type Creature, normal layout and black border color, by artist Matthew D. Wilson?
in French refers to language = 'French'; black border color refers to borderColor = 'black'
SELECT name FROM foreign_data WHERE uuid IN ( SELECT uuid FROM cards WHERE types = 'Creature' AND layout = 'normal' AND borderColor = 'black' AND artist = 'Matthew D. Wilson' ) AND language = 'French'
412
moderate
european_football_2
Which teams have build up play passing more than 70? Please list their short names.
build up play passing refers to buildUpPlayPassing; buildUpPlayPassing > 70; short names refers to team_short_name;
SELECT DISTINCT t1.team_short_name FROM Team AS t1 INNER JOIN Team_Attributes AS t2 ON t1.team_api_id = t2.team_api_id WHERE t2.buildUpPlayPassing > 70
1,067
moderate
card_games
For the set which had 'SS2' as the code, what is its magic card market id?
magic card market id refers to mcmId
SELECT mcmId FROM sets WHERE code = 'SS2'
490
simple
formula_1
How many wins was achieved by the oldest racer? Indicate his/her full name.
oldest racer refers to MIN(dob); full name refers to forename, surname.
SELECT SUM(T1.wins) FROM driverStandings AS T1 INNER JOIN drivers AS T2 on T1.driverId = T2.driverId GROUP BY T2.forename, T2.surname ORDER BY T2.dob ASC LIMIT 1
1,004
simple
thrombosis_prediction
Among the patients whose total bilirubin is over the normal range, how many of them have a peripheral pattern observed in the sheet of ANA examination?
total bilirubin is over the normal range refers to `T-BIL` > = 2.0; peripheral pattern is observed in the sheet of ANA examination refers to that ANA Pattern contains 'P';
SELECT COUNT(T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID INNER JOIN Examination AS T3 ON T1.ID = T3.ID WHERE T2.`T-BIL` >= 2 AND T3.`ANA Pattern` LIKE '%P%'
1,295
challenging
superhero
How many superheroes have durability of less than 50?
durability of less than 50 refers to attribute_name = 'Durability' AND attribute_value < 50
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 = 'Durability' AND T1.attribute_value < 50
738
simple
codebase_community
Which user has the website URL listed at 'http://stackoverflow.com'
"http://stackoverflow.com" is the WebsiteUrl; user refers to DisplayName
SELECT DisplayName FROM users WHERE WebsiteUrl = 'http://stackoverflow.com'
574
simple
thrombosis_prediction
How many male patients are are with creatinine index out of the normal range?
creatinine (CRE) out of the normal range refers to CRE > = 1.5; Male refers to Sex = 'M'
SELECT COUNT(T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.CRE >= 1.5 AND T1.SEX = 'M'
1,222
simple
codebase_community
What is the average score of the posts owned by the user csgillespie?
"csgillespie" is the DisplayName of user; average score refers to AVG(Score)
SELECT AVG(T1.Score) FROM posts AS T1 INNER JOIN users AS T2 ON T1.OwnerUserId = T2.Id WHERE T2.DisplayName = 'csgillespie'
555
simple
codebase_community
From which post is the most popular tag excerpted from? Please give the body of the post.
most popular tag refers to Max(Count); excerpt from refer to ExcerptPostId
SELECT Body FROM posts WHERE id = ( SELECT ExcerptPostId FROM tags ORDER BY Count DESC LIMIT 1 )
550
simple
california_schools
What is the educational level name for the schools with Breakfast Provision 2 in county code 37? Indicate the name of the school.
SELECT T2.EILName, T2.School FROM frpm AS T1 INNER JOIN schools AS T2 ON T1.CDSCode = T2.CDSCode WHERE T1.`NSLP Provision Status` = 'Breakfast Provision 2' AND T1.`County Code` = 37
75
simple
european_football_2
List down 5 tallest players' name.
tallest refers to MAX(height)
SELECT player_name FROM Player ORDER BY height DESC LIMIT 5
1,116
simple
toxicology
List all carcinogenic molecules and their elements.
label = '+' mean molecules are carcinogenic; 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 T2.molecule_id, T1.element FROM atom AS T1 INNER JOIN molecule AS T2 ON T1.molecule_id = T2.molecule_id WHERE T2.label = '+'
304
challenging
superhero
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.
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 REAL) * 100 / (SELECT COUNT(*) FROM superhero)), CAST(SUM(CASE WHEN T2.publisher_name = 'Marvel Comics' THEN 1 ELSE 0 END) AS REAL) 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'
743
challenging
european_football_2
Tell the defensive work rate for Kevin Berigaud on 2013/2/22.
Kevin Berigaud refers to player_name = 'Kevin Berigaud'; on 2013/2/22 refers to date = '2013-02-22 00:00:00'
SELECT t2.defensive_work_rate FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_fifa_api_id = t2.player_fifa_api_id WHERE SUBSTR(t2.`date`, 1, 10) = '2013-02-22' AND t1.player_name = 'Kevin Berigaud'
1,106
moderate
student_club
What is the last name and position of the student that bought pizza on 09/10/2019?
bought pizza on 09/10/2019 refers to expense_description = 'Pizza' where expense_date = '2019-09-10'
SELECT T1.last_name, T1.position FROM member AS T1 INNER JOIN expense AS T2 ON T1.member_id = T2.link_to_member WHERE T2.expense_date = '2019-09-10' AND T2.expense_description = 'Pizza'
1,430
moderate
toxicology
How many of the molecules are not carcinogenic?
label = '-' means molecules are non-carcinogenic
SELECT COUNT(T.molecule_id) FROM molecule AS T WHERE T.label = '-'
241
simple
formula_1
What's the reference name of Marina Bay Street Circuit?
reference name refers to circuitRef
SELECT circuitRef FROM circuits WHERE name = 'Marina Bay Street Circuit'
912
simple
formula_1
How many circuits are there in Melbourne, Australia?
Australia is the country; Melbourne is the location of circuit;
SELECT COUNT(circuitId) FROM circuits WHERE location = 'Melbourne' AND country = 'Australia'
945
simple
formula_1
In which years did Lewis Hamilton participate in a Formula_1 race?
SELECT DISTINCT T1.year FROM races AS T1 INNER JOIN results AS T2 ON T2.raceId = T1.raceId INNER JOIN drivers AS T3 ON T3.driverId = T2.driverId WHERE T3.forename = 'Lewis' AND T3.surname = 'Hamilton'
932
simple
superhero
What is the publisher name of the superhero ID 38?
superhero ID 38 refers to superhero.id = 38;
SELECT T2.publisher_name FROM superhero AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.id WHERE T1.id = 38
809
simple
card_games
Point out the language of set id "174"?
SELECT language FROM set_translations WHERE id = 174
438
simple
codebase_community
Write down the related posts titles and link type IDs of the post "What are principal component scores?".
Title = 'What are principal component scores?';
SELECT T3.Title, T2.LinkTypeId FROM posts AS T1 INNER JOIN postLinks AS T2 ON T1.Id = T2.PostId INNER JOIN posts AS T3 ON T2.RelatedPostId = T3.Id WHERE T1.Title = 'What are principal component scores?'
655
simple
european_football_2
Which player has the highest overall rating? Indicate the player's api id.
highest overall rating refers to MAX(overall_rating);
SELECT player_api_id FROM Player_Attributes ORDER BY overall_rating DESC LIMIT 1
1,020
simple
thrombosis_prediction
Among the patients have blood clots in veins, how many of them have a normal level of complement 4?
APS will result in Blood Clots in veins; normal level of complement 4 refers to C4 > 10; Should compute the number of different ones
SELECT COUNT(DISTINCT T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.C4 > 10 AND T1.Diagnosis = 'APS'
1,264
moderate
superhero
Indicate the attribute value of superhero Abomination.
Abomination refers to superhero_name = 'Abomination';
SELECT T2.attribute_value FROM superhero AS T1 INNER JOIN hero_attribute AS T2 ON T1.id = T2.hero_id WHERE T1.superhero_name = 'Abomination'
763
simple
thrombosis_prediction
For the patient who got the laboratory test of uric acid level as 8.4 on 1991-10-21, how old was he/she at that time?
how old at that time refers to SUBTRACT('1992', year(Birthday)); uric acid level as 8.4 refers to UA = '8.4'; 1991/10/21 refers to Date = '1991-10-21'
SELECT STRFTIME('%Y', T2.Date) - STRFTIME('%Y', T1.Birthday) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.UA = 8.4 AND T2.Date = '1991-10-21'
1,181
moderate
california_schools
Under whose administration does the school with the highest number of test takers whose total SAT Scores are greater or equal to 1500 belong to? Indicate his or her full name.
full name means first name, last name; There are at most 3 administrators for each school; SAT Scores are greater or equal to 1500 refers to NumGE1500
SELECT T2.AdmFName1, T2.AdmLName1, T2.AdmFName2, T2.AdmLName2, T2.AdmFName3, T2.AdmLName3 FROM satscores AS T1 INNER JOIN schools AS T2 ON T1.cds = T2.CDSCode ORDER BY T1.NumGE1500 DESC LIMIT 1
36
challenging
superhero
How many bad superheroes are there?
bad superheroes refers to alignment_id = Bad
SELECT COUNT(T1.id) FROM superhero AS T1 INNER JOIN alignment AS T2 ON T1.alignment_id = T2.id WHERE T2.alignment = 'Bad'
756
simple
thrombosis_prediction
For the examinations done after 1997/1/1, how many of them have the result of an inactivated partial prothrom bin time?
examinations done after 1997/1/1 refers to `Examination Date` > '1997-01-01'; normal activated partial prothrom bin time refesr to APTT < 45;
SELECT COUNT(T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.Date > '1997-01-01' AND T2.APTT >= 45
1,245
moderate
student_club
What are the expenses of the budget with the lowest remaining?
expense of budget refers to expense_description; lowest remaining refers to MIN(remaining)
SELECT T2.expense_description FROM budget AS T1 INNER JOIN expense AS T2 ON T1.budget_id = T2.link_to_budget ORDER BY T1.remaining LIMIT 1
1,365
simple
european_football_2
Sum up the away team goal scored by both Daan Smith and Filipe Ferreira.
Daan Smith refers to player_name = 'Daan Smith'; Filipe Ferreira refers to player_name = 'Filipe Ferreira'
SELECT SUM(t2.away_team_goal) FROM Player AS t1 INNER JOIN match AS t2 ON t1.player_api_id = t2.away_player_5 WHERE t1.player_name IN ('Daan Smith', 'Filipe Ferreira')
1,120
moderate
card_games
Which Russian set of cards contains the most cards overall?
Russian refers to language = 'Russian'; contains the most cards overall refers to MAX(baseSetSize)
SELECT T1.id FROM sets AS T1 INNER JOIN set_translations AS T2 ON T1.code = T2.setCode WHERE T2.language = 'Russian' GROUP BY T1.baseSetSize ORDER BY COUNT(T1.id) DESC LIMIT 1
432
moderate
superhero
How many vampire superheroes are there?
vampire superheroes refers to race = 'Vampire'
SELECT COUNT(T1.superhero_name) FROM superhero AS T1 INNER JOIN race AS T2 ON T1.race_id = T2.id WHERE T2.race = 'Vampire'
742
simple
student_club
Among the members with t-shirt size of medium, what is the percentage of the amount 50 received by the Student_Club?
t_shirt_size = 'Medium' where position = 'Member'; percentage = DIVIDE(COUNT(amount = 50), COUNT(member_id)) * 100
SELECT CAST(SUM(CASE WHEN T2.amount = 50 THEN 1.0 ELSE 0 END) AS REAL) * 100 / COUNT(T2.income_id) FROM member AS T1 INNER JOIN income AS T2 ON T1.member_id = T2.link_to_member WHERE T1.position = 'Member' AND T1.t_shirt_size = 'Medium'
1,432
moderate
superhero
Among all superheroes created by George Lucas, identify the percentage of female superheroes.
created by George Lucas refers to publisher_name = 'George Lucas'; percentage = MULTIPLY(DIVIDE(SUM(gender = 'Female' WHERE publisher_name = 'George Lucas'), COUNT(publisher_name = 'George Lucas')), 100.0); female refers to gender = 'Female';
SELECT CAST(COUNT(CASE WHEN T3.gender = 'Female' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.id) 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 WHERE T2.publisher_name = 'George Lucas'
834
challenging
european_football_2
Which player is the tallest?
tallest player refers to MAX(height);
SELECT player_name FROM Player ORDER BY height DESC LIMIT 1
1,079
simple
card_games
What percentage of Japanese translated sets are expansion sets?
Japanese translated refers to language = 'Japanese'; expansion sets refers to type = 'expansion'; percentage = DIVIDE(COUNT(language = 'Japanese'),COUNT(language))*100
SELECT CAST(SUM(CASE WHEN T2.language = 'Japanese' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.id) FROM sets AS T1 INNER JOIN set_translations AS T2 ON T1.code = T2.setCode WHERE T1.type = 'expansion'
417
moderate
european_football_2
How many home team goal have been scored by Aaron Lennon?
Aaron Lennon refers to player_name = 'Aaron Lennon'
SELECT SUM(t2.home_team_goal) FROM Player AS t1 INNER JOIN match AS t2 ON t1.player_api_id = t2.away_player_9 WHERE t1.player_name = 'Aaron Lennon'
1,119
simple
financial
How many male customers who are living in North Bohemia have average salary greater than 8000?
Male means that gender = 'M'; A3 refers to region; A11 pertains to average salary.
SELECT COUNT(T1.client_id) FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T1.gender = 'M' AND T2.A3 = 'North Bohemia' AND T2.A11 > 8000
93
moderate
superhero
Provide the full name of the superhero named Alien.
SELECT full_name FROM superhero WHERE superhero_name = 'Alien'
838
simple
student_club
What is the status of the event which bought "Post Cards, Posters" on 2019/8/20?
'Post Cards, Posters' is an expense description; on 2019/8/20 refers to expense_date = '2019-8-20'; status of event refers to event_status
SELECT T1.event_status FROM budget AS T1 INNER JOIN expense AS T2 ON T1.budget_id = T2.link_to_budget WHERE T2.expense_description = 'Post Cards, Posters' AND T2.expense_date = '2019-08-20'
1,350
moderate
thrombosis_prediction
Please list a patient's platelet level if it is within the normal range and if he or she is diagnosed with MCTD.
PLT > 100 and PLT < 400 means platelet level is within the normal range; PLT < 100 and PLT > 400 means platelet level is not within the normal range; diagnosed with MCTD refers to Diagnosis = 'MCTD';
SELECT T2.PLT FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T1.Diagnosis = 'MCTD' AND T2.PLT BETWEEN 100 AND 400
1,309
moderate
toxicology
Which element is the least numerous in non-carcinogenic molecules?
label = '-' means molecules are non-carcinogenic; 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 ( SELECT T1.element, COUNT(DISTINCT T1.molecule_id) FROM atom AS T1 INNER JOIN molecule AS T2 ON T1.molecule_id = T2.molecule_id WHERE T2.label = '-' GROUP BY T1.element ORDER BY COUNT(DISTINCT T1.molecule_id) ASC LIMIT 4 ) t
212
challenging
financial
In the branch where the largest number of crimes were committed in 1996, how many accounts were opened?
A16 stands for no. of committed crimes 1996
SELECT COUNT(T2.account_id) FROM district AS T1 INNER JOIN account AS T2 ON T1.district_id = T2.district_id GROUP BY T1.A16 ORDER BY T1.A16 DESC LIMIT 1
134
simple
codebase_community
Among the badges obtained by csgillespie, how many of them were obtained in the year 2011?
"csgillespie" is the DisplayName of user; obtained in 2011 refers to YEAR (Date) = 2011
SELECT COUNT(T1.Id) FROM badges AS T1 INNER JOIN users AS T2 ON T1.UserId = T2.Id WHERE STRFTIME('%Y', T1.Date) = '2011' AND T2.DisplayName = 'csgillespie'
553
simple
student_club
List all the members who attended the event "October Meeting".
'October Meeting' is an event name;
SELECT DISTINCT T3.member_id FROM event AS T1 INNER JOIN attendance AS T2 ON T1.event_id = T2.link_to_event INNER JOIN member AS T3 ON T2.link_to_member = T3.member_id WHERE T1.event_name = 'October Meeting'
1,366
simple
toxicology
What is the difference between the number of molecules that are carcinogenic and those that are not?
label = '+' means molecules are carcinogenic; label = '-' means molecules are non-carcinogenic; difference = SUBTRACT(SUM(label = '+'), SUM(label = '-'))
SELECT COUNT(CASE WHEN T.label = '+' THEN T.molecule_id ELSE NULL END) - COUNT(CASE WHEN T.label = '-' THEN T.molecule_id ELSE NULL END) AS diff_car_notcar FROM molecule t
222
moderate
formula_1
What's Lucas di Grassi's Q1 result in the race No. 345?
race number refers to raceId;
SELECT T1.q1 FROM qualifying AS T1 INNER JOIN drivers AS T2 ON T2.driverId = T1.driverId WHERE T1.raceId = 345 AND T2.forename = 'Lucas' AND T2.surname = 'di Grassi'
870
simple
formula_1
What is the lap record set by Lewis Hamilton in a Formula_1 race?
lap recod means the fastest time recorded which refers to time
SELECT T1.time FROM lapTimes AS T1 INNER JOIN drivers AS T2 on T1.driverId = T2.driverId WHERE T2.forename = 'Lewis' AND T2.surname = 'Hamilton'
1,010
simple
formula_1
List circuits which host 4 f1 races from year 1990 to 2000.
from year 1990 to 2000 refers to year(date) between 1990 and 2000;
SELECT DISTINCT T1.name FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE STRFTIME('%Y', T2.date) BETWEEN '1990' AND '2000' GROUP BY T1.name HAVING COUNT(T2.raceId) = 4
899
moderate
thrombosis_prediction
Among the patients with the normal level of triglyceride, how many of them have other symptoms observed?
normal level of triglyceride refers to TG < 200; have other symptoms refers to Symptoms is not null;
SELECT COUNT(T1.ID) FROM Examination AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.TG < 200 AND T1.Symptoms IS NOT NULL
1,299
simple
california_schools
List the top five schools, by descending order, from the highest to the lowest, the most number of Enrollment (Ages 5-17). Please give their NCES school identification number.
SELECT T1.NCESSchool FROM schools AS T1 INNER JOIN frpm AS T2 ON T1.CDSCode = T2.CDSCode ORDER BY T2.`Enrollment (Ages 5-17)` DESC LIMIT 5
14
simple
financial
Between 1/1/1995 and 12/31/1997, how many loans in the amount of at least 250,000 per account that chose monthly statement issuance were approved?
Frequency = 'POPLATEK MESICNE' stands for monthly issurance
SELECT COUNT(T1.account_id) FROM account AS T1 INNER JOIN loan AS T2 ON T1.account_id = T2.account_id WHERE T2.date BETWEEN '1995-01-01' AND '1997-12-31' AND T1.frequency = 'POPLATEK MESICNE' AND T2.amount > 250000
136
moderate
california_schools
How many schools with an average score in Math under 400 in the SAT test are exclusively virtual?
Exclusively virtual refers to Virtual = 'F'
SELECT COUNT(DISTINCT T2.School) FROM satscores AS T1 INNER JOIN schools AS T2 ON T1.cds = T2.CDSCode WHERE T2.Virtual = 'F' AND T1.AvgScrMath < 400
5
simple
student_club
Please indicate the college of the person whose first name is Katy with the link to the major "rec1N0upiVLy5esTO".
SELECT T2.college FROM member AS T1 INNER JOIN major AS T2 ON T2.major_id = T1.link_to_major WHERE T1.link_to_major = 'rec1N0upiVLy5esTO' AND T1.first_name = 'Katy'
1,438
simple
card_games
What is the type of card "Benalish Knight"?
Benalish Knight' is the name of card;
SELECT DISTINCT T1.type FROM cards AS T1 INNER JOIN foreign_data AS T2 ON T1.uuid = T2.uuid WHERE T1.name = 'Benalish Knight'
365
simple
european_football_2
Among the players born before the year 1986, how many of them would remain in his position and defense while the team attacked?
players born before the year 1986 refers to strftime('%Y', birthday)<'1986'; players who would remain in his position and defense while the team attacked refers to defensive_work_rate = 'high';
SELECT COUNT(DISTINCT t1.player_name) FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_api_id = t2.player_api_id WHERE SUBSTR(t1.birthday, 1, 4) < '1986' AND t2.defensive_work_rate = 'high'
1,084
challenging
toxicology
What are the atoms that are bonded in the molecule TR001 with the bond ID of TR001_2_6?
TR001 is the molecule id; TR001_2_6 is the bond id
SELECT SUBSTR(T.bond_id, 1, 7) AS atom_id1 , T.molecule_id || SUBSTR(T.bond_id, 8, 2) AS atom_id2 FROM bond AS T WHERE T.molecule_id = 'TR001' AND T.bond_id = 'TR001_2_6'
221
simple
toxicology
How much of the hydrogen in molecule TR206 is accounted for? Please provide your answer in percentage.
hydrogen refers to element = 'h'; TR206 is the molecule id; percentage = DIVIDE(SUM(element = 'h'), COUNT(atom_id)) as percent where molecule_id = 'TR206'
SELECT CAST(COUNT(CASE WHEN T.element = 'h' THEN T.atom_id ELSE NULL END) AS REAL) * 100 / COUNT(T.atom_id) FROM atom AS T WHERE T.molecule_id = 'TR206'
228
moderate
financial
What is the region of the client with the id 3541 from?
A3 refers to region
SELECT T2.district_id, T1.A3 FROM district AS T1 INNER JOIN client AS T2 ON T1.district_id = T2.district_id WHERE T2.client_id = 3541
162
simple
thrombosis_prediction
How many patients accepted to the hospital have a normal level of white blood cells?
accepted to the hospital refers to Admission = '+'; normal level of white blood cells refers to WBC between 3.5 and 9.0;
SELECT COUNT(T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.WBC BETWEEN 3.5 AND 9 AND T1.Admission = '+'
1,305
moderate
toxicology
What atoms are connected in single type bonds?
single type bond refers to bond_type = '-';
SELECT T2.atom_id, T2.atom_id2 FROM bond AS T1 INNER JOIN connected AS T2 ON T1.bond_id = T2.bond_id WHERE T1.bond_type = '-'
210
simple
financial
What was the difference in the number of crimes committed in East and North Bohemia in 1996?
Difference in no. of committed crimes between 2 regions = Total no. of committed crimes in 1996 in North Bohemia - Total no. of committed crimes in 1996 in East Bohemia. A3 refers to region. Data about no. of committed crimes 1996 appears in A16
SELECT SUM(IIF(A3 = 'East Bohemia', A16, 0)) - SUM(IIF(A3 = 'North Bohemia', A16, 0)) FROM district
171
moderate
european_football_2
How many matches in the 2015/2016 season were held in Scotland Premier League ?
Scotland Premier League refers to League.name = 'Scotland Premier League';
SELECT COUNT(t2.id) FROM League AS t1 INNER JOIN Match AS t2 ON t1.id = t2.league_id WHERE t2.season = '2015/2016' AND t1.name = 'Scotland Premier League'
1,049
simple
thrombosis_prediction
What is the average blood albumin level for female patients with a PLT greater than 400 who have been diagnosed with SLE?
average blood albumin level refers to AVG(ALB); female refers to SEX = 'F'; PLT greater than 400 refers to PLT > 400; 'SLE' refers to diagnosis
SELECT AVG(T2.ALB) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.PLT > 400 AND T1.Diagnosis = 'SLE' AND T1.SEX = 'F'
1,195
moderate
thrombosis_prediction
Who is the oldest patient with the highest total cholesterol (T-CHO). State the patient ID and T-CHO index.
oldest patient refers to MIN(birthday); highest total cholesterol refers to MAX(T-CHO);
SELECT T1.ID, T2.`T-CHO` FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID ORDER BY T2.`T-CHO` DESC, T1.Birthday ASC LIMIT 1
1,226
simple
student_club
How many income generated by Grant Gilmour?
income generated refers to income.amount
SELECT T2.amount FROM member AS T1 INNER JOIN income AS T2 ON T1.member_id = T2.link_to_member WHERE T1.first_name = 'Grant' AND T1.last_name = 'Gilmour'
1,384
simple
superhero
State all of 3-D Man's attributes along with their values.
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'
796
moderate
formula_1
What is full name of the racer who ranked 1st in the 3rd qualifying race held in the Marina Bay Street Circuit in 2008?
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 q3 IS NOT 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 INTEGER) * 60 + CAST(SUBSTR(q3, INSTR(q3, ':') + 1, INSTR(q3, '.') - INSTR(q3, ':') - 1) AS REAL) + CAST(SUBSTR(q3, INSTR(q3, '.') + 1) AS REAL) / 1000 ASC LIMIT 1
1,001
challenging
european_football_2
What is the average heights of Italy players?
average heights refers to Avg(height); Italy is name of country
SELECT CAST(SUM(T1.height) AS REAL) / COUNT(T1.id) FROM Player AS T1 INNER JOIN Match AS T2 ON T1.id = T2.id INNER JOIN Country AS T3 ON T2.country_id = T3.ID WHERE T3.NAME = 'Italy'
1,131
simple
debit_card_specializing
What is the biggest monthly consumption of the customers who use euro as their currency?
Monthly consumption = SUM(consumption) / 12
SELECT SUM(T2.Consumption) / 12 AS MonthlyConsumption FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Currency = 'EUR' GROUP BY T1.CustomerID ORDER BY MonthlyConsumption DESC LIMIT 1
1,499
simple
card_games
List all the card id and artist with unknown power which are legal for commander play format.
unknown power refers to power = '*' or POWER IS NULL; commander play format refers to format = 'commander'; legal for commander play format refers to format = 'commander' where status = 'Legal'
SELECT T1.id, T1.artist FROM cards AS T1 INNER JOIN legalities AS T2 ON T1.uuid = T2.uuid WHERE T2.status = 'Legal' AND T2.format = 'commander' AND (T1.power IS NULL OR T1.power = '*')
346
moderate
toxicology
How many single bonds are there in the list?
single bond refers to bond_type = '-';
SELECT COUNT(T.bond_id) FROM bond AS T WHERE T.bond_type = '-'
314
simple
european_football_2
How many players had the highest potential score for crossing that preferred to use their left foots while attacking?
highest potential score for crossing refers to MAX(crossing); preferred to use their left foots refers to preferred_foot = 'left'
SELECT COUNT(t1.id) FROM Player_Attributes AS t1 WHERE t1.preferred_foot = 'left' AND t1.crossing = ( SELECT MAX(crossing) FROM Player_Attributes)
1,136
moderate
california_schools
When did the first-through-twelfth-grade school with the largest enrollment open?
K-12 means First-through-twelfth-grade
SELECT T2.OpenDate FROM frpm AS T1 INNER JOIN schools AS T2 ON T1.CDSCode = T2.CDSCode ORDER BY T1.`Enrollment (K-12)` DESC LIMIT 1
29
simple
card_games
How many rare enchantment Abundance cards are there whose play format status are all legal?
rare refers to rarity = 'rare'; enchantment card refers to types = 'Enchantment'; Abundance cards refers to name = 'Abundance'; format status are all legal refers to status = 'Legal'
SELECT COUNT(T1.id) FROM cards AS T1 INNER JOIN legalities AS T2 ON T2.uuid = T1.uuid WHERE T1.rarity = 'rare' AND T1.types = 'Enchantment' AND T1.name = 'Abundance' AND T2.status = 'Legal'
517
moderate
toxicology
What is the type of bond that molecule TR000 has when involved in any bonds?
type of bond refers to bond_type; TR000 is the molecule id
SELECT DISTINCT T.bond_type FROM bond AS T WHERE T.molecule_id = 'TR000'
229
simple
superhero
Among the bad superheroes, what is the percentage of female superheroes?
bad superheroes refers to alignment.id = 2; percentage = MULTIPLY(DIVIDE(SUM(gender.id = 2 WHERE alignment.id = 2), COUNT(alignment.id = 2)), 100.0); female refers to gender.id = 2;
SELECT CAST(COUNT(CASE WHEN T3.gender = 'Female' THEN T1.id ELSE NULL END) AS REAL) * 100 / COUNT(T1.id) FROM superhero AS T1 INNER JOIN alignment AS T2 ON T1.alignment_id = T2.id INNER JOIN gender AS T3 ON T1.gender_id = T3.id WHERE T2.alignment = 'Bad'
818
challenging
california_schools
What are the two most common first names among the school administrators? Indicate the district to which they administer.
SELECT DISTINCT T1.AdmFName1, T1.District FROM schools AS T1 INNER JOIN ( SELECT admfname1 FROM schools GROUP BY admfname1 ORDER BY COUNT(admfname1) DESC LIMIT 2 ) AS T2 ON T1.AdmFName1 = T2.admfname1
84
simple
european_football_2
List the football teams that has a chance creation passing class of Risky. Inidcate its short name only.
chance creation passing class refers to chanceCreationPassingClass; chanceCreationPassingClass = 'Risky'; short name refers to team_short_name;
SELECT DISTINCT t1.team_short_name FROM Team AS t1 INNER JOIN Team_attributes AS t2 ON t1.team_api_id = t2.team_api_id WHERE t2.chanceCreationPassingClass = 'Risky'
1,053
moderate
thrombosis_prediction
For the patients whose anti-SSB are normal, how many of them have other symptoms observed in their examination?
anti-SSB are normal refers to SSB IN('-', '+-'); have other symptoms refers to Symptoms IS NOT NULL; Should compute the number of distinct ones
SELECT COUNT(DISTINCT T1.ID) FROM Examination AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.SSB = 'negative' OR '0' AND T1.Symptoms IS NOT NULL
1,274
moderate
european_football_2
What was the highest score of the home team in the Netherlands Eredivisie league?
highest score of the home team refers to MAX(home_team_goal)
SELECT MAX(t2.home_team_goal) FROM League AS t1 INNER JOIN Match AS t2 ON t1.id = t2.league_id WHERE t1.name = 'Netherlands Eredivisie'
1,143
simple
codebase_community
How many users were awarded with 'Citizen Patrol' badge?
Citizen Patrol' is the name of the badge;
SELECT COUNT(id) FROM badges WHERE `Name` = 'Citizen Patrol'
695
simple
toxicology
Identify whether the molecule that contains atom TR001_1 is carcinogenic.
label = '+' mean molecules are carcinogenic;
SELECT T2.label AS flag_carcinogenic FROM atom AS T1 INNER JOIN molecule AS T2 ON T1.molecule_id = T2.molecule_id WHERE T1.atom_id = 'TR001_1'
288
simple
codebase_community
What is the score of the post with the most popular tag?
Higher view count means the post has higher popularity; the most popular tag refers to MAX(Count);
SELECT Score FROM posts WHERE Id = ( SELECT ExcerptPostId FROM tags ORDER BY Count DESC LIMIT 1 )
664
simple
thrombosis_prediction
List all patients who first came to the hospital after year 1992 with prothrombin time (PT) level that are normal.
first came to the hospital after year 1992 refers to year(`First Date`) > 1992; prothrombin time (PT) level that are normal refers to PT < 14;
SELECT T1.ID FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE STRFTIME('%Y', T1.`First Date`) > '1992' AND T2.PT < 14
1,244
moderate
formula_1
When was the last f1 season whereby Brands Hatch hosted the British Grand Prix?
the last refers to max(year);
SELECT T2.date FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T1.name = 'Brands Hatch' AND T2.name = 'British Grand Prix' ORDER BY T2.year DESC LIMIT 1
889
simple
codebase_community
For the user with the display name of "Tiago Pasqualini", how many posts did he/she own?
"Tiago Pasqualini" is the DisplayName;
SELECT COUNT(T1.Id) FROM users AS T1 INNER JOIN posts AS T2 ON T1.Id = T2.OwnerUserId WHERE T1.DisplayName = 'Tiago Pasqualini'
567
simple
codebase_community
Based on posts posted by Community, calculate the percentage of posts that use the R language.
DIVIDE(COUNT(PostId WHERE TagName = R language)), (COUNT(PostId WHERE DisplayName = 'Community')) as percentage; R language refers to tagname = 'r'
SELECT CAST(SUM(IIF(T3.TagName = 'r', 1, 0)) AS REAL) * 100 / COUNT(T1.Id) FROM users AS T1 INNER JOIN postHistory AS T2 ON T1.Id = T2.UserId INNER JOIN tags AS T3 ON T3.ExcerptPostId = T2.PostId WHERE T1.DisplayName = 'Community'
639
challenging
california_schools
What is the total number of schools whose total SAT scores are greater or equal to 1500 whose mailing city is Lakeport?
Total SAT scores can be computed by AvgScrRead + AvgScrMath + AvgScrWrite
SELECT COUNT(T1.cds) FROM satscores AS T1 INNER JOIN schools AS T2 ON T1.cds = T2.CDSCode WHERE T2.MailCity = 'Lakeport' AND (T1.AvgScrRead + T1.AvgScrMath + T1.AvgScrWrite) >= 1500
52
simple