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
debit_card_specializing
Please list the product description of the products consumed in September, 2013.
September 2013 refers to 201309; First 4 strings represent the year
SELECT T3.Description FROM transactions_1k AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN products AS T3 ON T1.ProductID = T3.ProductID WHERE T2.Date = '201309'
1,500
simple
formula_1
For the driver who had the Q2 time as 0:01:40 in the qualifying race No. 355, what is his nationality?
race number refers to raceId;
SELECT DISTINCT T2.nationality FROM qualifying AS T1 INNER JOIN drivers AS T2 ON T2.driverId = T1.driverId WHERE T1.raceId = 355 AND T1.q2 LIKE '1:40%'
860
simple
toxicology
List down atom id2 for atoms with element sulfur.
element sulfur refers to element = 's'
SELECT DISTINCT T2.atom_id2 FROM atom AS T1 INNER JOIN connected AS T2 ON T1.atom_id = T2.atom_id WHERE T1.element = 's'
257
simple
superhero
What is Copycat's race?
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'
737
simple
thrombosis_prediction
For patient with albumin level lower than 3.5, list their ID, sex and diagnosis.
albumin level lower than 3.5 refers to ALB < 3.5;
SELECT DISTINCT T1.ID, T1.SEX, T1.Diagnosis FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.ALB < 3.5
1,159
simple
european_football_2
What's the long name for the team GEN?
long name for the team refers to team_long_name; team_short_name = 'GEN';
SELECT team_long_name FROM Team WHERE team_short_name = 'GEN'
1,077
simple
debit_card_specializing
How many more "discount" gas stations does the Czech Republic have compared to Slovakia?
Computation of more discount = Total no. of discount gas stations in Czech Republic - Total no. of discount gas stations in Slovakia
SELECT SUM(IIF(Country = 'CZE', 1, 0)) - SUM(IIF(Country = 'SVK', 1, 0)) FROM gasstations WHERE Segment = 'Discount'
1,484
simple
superhero
Among all superheroes in Marvel Comics, identify the percentage of 'good' superheroes.
Marvel Comics refers to publisher_name = 'Marvel Comics'; percentage = MULTIPLY(DIVIDE(SUM(alignment = 'Good' WHERE publisher_name = 'Marvel Comics'), COUNT(publisher_name = 'Marvel Comics')), 100.0); good superheroes refers to alignment = 'Good';
SELECT CAST(COUNT(CASE WHEN T3.alignment = 'Good' THEN T1.id 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 alignment AS T3 ON T1.alignment_id = T3.id WHERE T2.publisher_name = 'Marvel Comics'
835
challenging
formula_1
What is the average lap time for Sebastian Vettel in the 2009 Chinese Grand Prix?
AVG(time);
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 = 'Sebastian' AND T3.surname = 'Vettel' AND T1.year = 2009 AND T1.name = 'Chinese GrAND Prix'
895
moderate
codebase_community
What is the display name of the user who has the most number of views?
user who has the most number of view refers to Max(Views)
SELECT DisplayName FROM users WHERE Views = ( SELECT MAX(Views) FROM users )
534
simple
european_football_2
List the top 5 leagues in ascending order of the number of goals made in all seasons combined.
number of goals made in all seasons combine = SUM(home_team_goal, away_team_goal);
SELECT t1.name, SUM(t2.home_team_goal) + SUM(t2.away_team_goal) FROM League AS t1 INNER JOIN Match AS t2 ON t1.id = t2.league_id GROUP BY t1.name ORDER BY SUM(t2.home_team_goal) + SUM(t2.away_team_goal) ASC LIMIT 5
1,038
moderate
toxicology
Find the triple-bonded molecules which are carcinogenic.
triple-bonded molecules refers to bond_type = '#'; carcinogenic refers to label = '+'
SELECT DISTINCT T2.molecule_id FROM bond AS T1 INNER JOIN molecule AS T2 ON T1.molecule_id = T2.molecule_id WHERE T1.bond_type = '#' AND T2.label = '+'
200
simple
codebase_community
What is the total number of comments of all the posts owned by csgillespie?
"csgillespie" is the DisplayName of user; total number of comments refers to Sum(CommentCount)
SELECT SUM(T1.CommentCount) FROM posts AS T1 INNER JOIN users AS T2 ON T1.OwnerUserId = T2.Id WHERE T2.DisplayName = 'csgillespie'
542
simple
formula_1
How many seasons has Silverstone Circuit hosted the United Kindom grand prix?
British Grand Prix is the name of race; British refers to the United Kindom
SELECT COUNT(T2.circuitid) FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T1.name = 'Silverstone Circuit' AND T2.name = 'British Grand Prix'
890
simple
codebase_community
Provide the users' display names and available website URLs of the post with favorite count of more than 150.
favorite count of more than 150 refers to FavoriteCount > 150;
SELECT T1.DisplayName, T1.WebsiteUrl FROM users AS T1 INNER JOIN posts AS T2 ON T1.Id = T2.OwnerUserId WHERE T2.FavoriteCount > 150
648
simple
student_club
Which students manage to generate the highest income. State his/her full name along with the income source.
name of students means the full name; full name refers to first_name, last_name; generate the highest income refers to MAX(income.amount);
SELECT T1.first_name, T1.last_name, T2.source FROM member AS T1 INNER JOIN income AS T2 ON T1.member_id = T2.link_to_member GROUP BY T1.first_name, T1.last_name, T2.source ORDER BY SUM(T2.amount) DESC LIMIT 1
1,388
moderate
card_games
Please list all the foreign languages in which the card "Ancestor's Chosen" has a flavor text.
"Ancestor''s Chosen" refers to name = 'Ancestor''s Chosen'; has a flavor text refers to flavorText is not null
SELECT T2.language FROM cards AS T1 INNER JOIN foreign_data AS T2 ON T2.uuid = T1.uuid WHERE T1.name = 'Ancestor''s Chosen' AND T2.flavorText IS NOT NULL
481
simple
codebase_community
Among the users who have more than 100 upvotes, how many of them have more then 1 downvotes?
more than 100 upvotes refers to Upvotes > 100; more than 1 downvotes refers to Downvotes > 1
SELECT COUNT(Id) FROM users WHERE Upvotes > 100 AND Downvotes > 1
535
simple
student_club
Calculate the difference of the total amount spent in all events by the Student_Club in year 2019 and 2020.
SUBTRACT(spent where YEAR(event_date) = 2019, spent where YEAR(event_date) = 2020)
SELECT SUM(CASE WHEN SUBSTR(T1.event_date, 1, 4) = '2019' THEN T2.spent ELSE 0 END) - SUM(CASE WHEN SUBSTR(T1.event_date, 1, 4) = '2020' THEN T2.spent ELSE 0 END) AS num FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event
1,340
moderate
european_football_2
What is the percentage of players that are under 180 cm who have an overall strength of more than 70?
percentage refers to DIVIDE(COUNT(height < 180 AND overall_rating > 70),COUNT(id)) * 100%
SELECT CAST(COUNT(CASE WHEN t2.overall_rating > 70 THEN t1.id ELSE NULL END) AS REAL) * 100 / COUNT(t1.id) percent FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_api_id = t2.player_api_id WHERE t1.height < 180
1,148
moderate
thrombosis_prediction
Among the patients followed at the outpatient clinic, how many of them have a normal level of alkaliphophatase?
followed at the outpatient clinic refers to Admission = '-'; normal level of alkaliphophatase refers to ALP < 300;
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,287
moderate
card_games
How many cards are there with toughness of 99?
SELECT COUNT(id) FROM cards WHERE toughness = 99
372
simple
thrombosis_prediction
What is the average index of the lactate dehydrogenase (LDH) for all patients with lactate dehydrogenase (LDH) within the normal range.
average index of the lactate dehydrogenase (LDH) refers to AVG(LDH); (LDH) within the normal range refers to LDH < 500
SELECT AVG(LDH) FROM Laboratory WHERE LDH < 500
1,210
simple
toxicology
How many elements are there for single bond molecules?
single bond refers to bond_type = '-';
SELECT COUNT(DISTINCT T.element) FROM ( SELECT DISTINCT T2.molecule_id, T1.element FROM atom AS T1 INNER JOIN molecule AS T2 ON T1.molecule_id = T2.molecule_id INNER JOIN bond AS T3 ON T2.molecule_id = T3.molecule_id WHERE T3.bond_type = '-' ) AS T
259
simple
card_games
Please list the name of the cards in the set Coldsnap with the highest converted mana cost.
card set Coldsnap refers to name = 'Coldsnap'
SELECT T1.name FROM cards AS T1 INNER JOIN sets AS T2 ON T2.code = T1.setCode WHERE T2.name = 'Coldsnap' ORDER BY T1.convertedManaCost DESC LIMIT 1
476
simple
toxicology
How many double bonds does TR006 have and is it carcinogenic?
label = '+' mean molecules are carcinogenic; label = '-' means molecules are non-carcinogenic; double bond refers to bond_type = ' = ';
SELECT COUNT(T1.bond_id), T2.label FROM bond AS T1 INNER JOIN molecule AS T2 ON T1.molecule_id = T2.molecule_id WHERE T1.bond_type = '=' AND T2.molecule_id = 'TR006' GROUP BY T2.label
303
moderate
california_schools
What is the average math score of the school with the lowest average score for all subjects, and in which county is it located?
Average score for all subjects can be computed by AvgScrMath + AvgScrRead + AvgScrWrite
SELECT T1.AvgScrMath, T2.County FROM satscores AS T1 INNER JOIN schools AS T2 ON T1.cds = T2.CDSCode WHERE T1.AvgScrMath IS NOT NULL ORDER BY T1.AvgScrMath + T1.AvgScrRead + T1.AvgScrWrite ASC LIMIT 1
43
moderate
card_games
List all the frame styles and cards Allen Williams worked on and find any banned cards if there are any.
frame styles refers to frameVersion; cards Allen Williams worked on refers to artist = 'Allen Williams'; banned cards refers to status = 'banned'
SELECT DISTINCT T1.frameVersion, T1.name , IIF(T2.status = 'Banned', T1.name, 'NO') FROM cards AS T1 INNER JOIN legalities AS T2 ON T1.uuid = T2.uuid WHERE T1.artist = 'Allen Williams'
530
moderate
financial
How many clients opened their accounts in Jesenik branch were women?
A2 has region names; Woman and female share the same meaning; female refers to gender = 'F'
SELECT COUNT(T1.client_id) FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T1.gender = 'F' AND T2.A2 = 'Jesenik'
109
simple
financial
What type of credit card does the client with the id 13539 own?
SELECT T3.type FROM disp AS T1 INNER JOIN client AS T2 ON T1.client_id = T2.client_id INNER JOIN card AS T3 ON T1.disp_id = T3.disp_id WHERE T2.client_id = 13539
161
simple
toxicology
Among the molecules which contain "cl" element, which of them are carcinogenic?
label = '+' mean molecules are carcinogenic;
SELECT DISTINCT T1.molecule_id FROM atom AS T1 INNER JOIN molecule AS T2 ON T1.molecule_id = T2.molecule_id WHERE T1.element = 'cl' AND T2.label = '+'
315
simple
card_games
Is there any card from Erica Yang artist in pauper format and available in paper? If so, indicate its ID.
available in paper refers to availability = 'paper'
SELECT T1.id FROM cards AS T1 INNER JOIN legalities AS T2 ON T1.uuid = T2.uuid WHERE T1.artist = 'Erica Yang' AND T2.format = 'pauper' AND T1.availability = 'paper'
410
simple
european_football_2
Among all the players whose weight is under 130, how many of them preferred foot in attacking is left?
weight < 130; preferred foot in attacking refers to preferred_foot; preferred_foot = 'left';
SELECT COUNT(DISTINCT t1.id) FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_api_id = t2.player_api_id WHERE t1.weight < 130 AND t2.preferred_foot = 'left'
1,052
moderate
card_games
What is the Simplified Chinese translation of the name of the set "Eighth Edition"?
Eighth Edition is the name of card set which refers to name = 'Eighth Edition'; Simplified Chinese is the language; translation of the name refers to translation
SELECT T2.translation FROM sets AS T1 INNER JOIN set_translations AS T2 ON T2.setCode = T1.code WHERE T1.name = 'Eighth Edition' AND T2.language = 'Chinese Simplified'
468
moderate
debit_card_specializing
What percentage of Slovakian gas stations are premium?
Percentage of premium gas station = (Total of premium gas station in Slovakia / Total of gas station in Slovakia) * 100%.
SELECT CAST(SUM(IIF(Segment = 'Premium', 1, 0)) AS FLOAT) * 100 / COUNT(GasStationID) FROM gasstations WHERE Country = 'SVK'
1,494
simple
toxicology
Enumerate the bond ID of triple bond type molecules and tell me if they are carcinogenic or not.
triple bond refers to bond_type = '#'; label = '+' mean molecules are carcinogenic; label = '-' means molecules are non-carcinogenic
SELECT DISTINCT T1.bond_id, T2.label FROM bond AS T1 INNER JOIN molecule AS T2 ON T1.molecule_id = T2.molecule_id WHERE T1.bond_type = '#'
280
moderate
debit_card_specializing
Which customer paid the most in 2012/8/25?
'2012/8/25' can be represented by '2012-08-25'
SELECT CustomerID FROM transactions_1k WHERE Date = '2012-08-25' GROUP BY CustomerID ORDER BY SUM(Price) DESC LIMIT 1
1,512
simple
thrombosis_prediction
How many patients have a normal anti-DNA level, yet their data are not recorded.
normal anti-DNA level refers to DNA < 8; data are not recorded refers to Description IS NULL; Should compute the number of unique ones
SELECT COUNT(DISTINCT T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.DNA < 8 AND T1.Description IS NULL
1,277
moderate
student_club
What is the name of the social event that was attended by the vice president of the Student_Club located at 900 E. Washington St.?
name of social event refers to event_name where type = 'Social'; 'Vice President' is position; located at refers to location
SELECT T2.event_name FROM attendance AS T1 INNER JOIN event AS T2 ON T2.event_id = T1.link_to_event INNER JOIN member AS T3 ON T1.link_to_member = T3.member_id WHERE T3.position = 'Vice President' AND T2.location = '900 E. Washington St.' AND T2.type = 'Social'
1,429
challenging
formula_1
Name the races along with its circuit name and location for f1 races hosted in September 2005.
in September 2005 refers to month(date) = 9 and year = 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 STRFTIME('%m', T2.date) = '09'
901
simple
toxicology
What is the label for bond ID TR001_10_11?
label = '+' mean molecules are carcinogenic; label = '-' means molecules are non-carcinogenic
SELECT T2.label FROM bond AS T1 INNER JOIN molecule AS T2 ON T1.molecule_id = T2.molecule_id WHERE T1.bond_id = 'TR001_10_11'
279
simple
european_football_2
Which foot is preferred by Abdou Diallo?
Abdou Diallo refers to player_name = 'Abdou Diallo'; foot is preferred refers to preferred_foot
SELECT DISTINCT t2.preferred_foot FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_api_id = t2.player_api_id WHERE t1.player_name = 'Abdou Diallo'
1,099
simple
card_games
Name all the cards which have alternative language in Japanese.
Japanese' is the language;
SELECT T1.name FROM cards AS T1 INNER JOIN foreign_data AS T2 ON T1.uuid = T2.uuid WHERE T2.language = 'Japanese'
351
simple
thrombosis_prediction
How many of the patients with the most serious thrombosis cases examined in 1997 are women?
the most serious thrombosis refers to Thrombosis = '1' (the most severe one); women refers to sex = 'F'
SELECT CAST(SUM(CASE WHEN T1.SEX = 'F' THEN 1 ELSE 0 END) AS REAL) / COUNT(*) FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID WHERE STRFTIME('%Y', T2.`Examination Date`) = '1997' AND T2.Thrombosis = 1
1,164
moderate
thrombosis_prediction
Which patient is the first patient with an abnormal anti-SSA to come to the hospital? Please give his or her ID.
first patient refers to ID with MIN(`First Date`); abnormal anti-SSA refers to SSA NOT IN('-', '+-');
SELECT T1.ID FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T1.`First Date` IS NOT NULL AND T2.SSA NOT IN ('negative', '0') ORDER BY T1.`First Date` ASC LIMIT 1
1,272
moderate
thrombosis_prediction
For patient born between Year 1930 to 1940, how many percent of them were inpatient?
patient born between Year 1930 to 1940 refers to year(Birthday) BETWEEN '1930-01-01' AND '1940-12-31'; inpatient refers to Admission = '+'
SELECT CAST(SUM(CASE WHEN Admission = '+' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Patient WHERE STRFTIME('%Y', Birthday) BETWEEN '1930' AND '1940'
1,151
moderate
student_club
What are the budget category of the events located at MU 215 and a guest speaker type with a 0 budget spent?
budget category refers to category; events located at refers to location; type = 'Guest Speaker'; 0 budget spent refers to spent = 0
SELECT DISTINCT T2.category, T1.type FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event WHERE T1.location = 'MU 215' AND T2.spent = 0 AND T1.type = 'Guest Speaker'
1,427
moderate
formula_1
What is the average lap time in milliseconds of all the lap records set on the various circuits in Italy?
average = AVG(milliseconds)
SELECT CAST(SUM(T1.milliseconds) AS REAL) / COUNT(T1.lap) FROM lapTimes AS T1 INNER JOIN races AS T2 on T1.raceId = T2.raceId INNER JOIN circuits AS T3 on T2.circuitId = T3.circuitId WHERE T3.country = 'Italy'
1,019
moderate
card_games
What percentage of cards without power are in French?
in French refers to language = 'French'; cards without power refers to power IS NULL OR power = '*'; percentage = DIVIDE(COUNT(language = 'French' and power is NULL or power = '*'), COUNT( power is NULL or power = '*'))*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.power IS NULL OR T1.power LIKE '%*%'
416
challenging
superhero
Provide the eye colour of the superhero who has Karen Beecher-Duncan as their full name.
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'
806
simple
debit_card_specializing
Which customers, paying in CZK, consumed the most gas in 2011?
Year 2011 can be presented as Between 201101 And 201112, which means between January and December in 2011
SELECT T1.CustomerID FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Currency = 'CZK' AND T2.Date BETWEEN 201101 AND 201112 GROUP BY T1.CustomerID ORDER BY SUM(T2.Consumption) DESC LIMIT 1
1,474
moderate
codebase_community
How many comments and answers were left by the users on the post with the title 'Clustering 1D data'?
SELECT CommentCount, AnswerCount FROM posts WHERE Title = 'Clustering 1D data'
698
simple
thrombosis_prediction
For the patients with an abnormal activated partial prothrom bin time, how many of them have a mild thrombosis?
abnormal activated partial prothrom bin time refers to APTT > 45; mild thrombosis refers to Thrombosis = 3; Only count ones without repetitive.
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 T3.Thrombosis = 3 AND T2.APTT > 45
1,246
moderate
superhero
What is the average height of a non-human superhero in Dark Horse Comics?
average = AVG(height_cm); non-human superhero refers to race <> 'Human'; Dark Horse Comics refers to publisher_name = 'Dark Horse Comics';
SELECT AVG(T1.height_cm) FROM superhero AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.id INNER JOIN race AS T3 ON T1.race_id = T3.id WHERE T2.publisher_name = 'Dark Horse Comics' AND T3.race != 'Human'
827
moderate
california_schools
What is the phone number and extension number for the school with the zip code 95203-3704? Indicate the school's name.
SELECT Phone, Ext, School FROM schools WHERE Zip = '95203-3704'
58
simple
formula_1
For the constructor which got the highest point in the race No. 9 , what is its introduction website?
race number refers to raceId; introduction website of the constructor refers to url;
SELECT T2.url FROM constructorResults AS T1 INNER JOIN constructors AS T2 ON T2.constructorId = T1.constructorId WHERE T1.raceId = 9 ORDER BY T1.points DESC LIMIT 1
869
moderate
superhero
Identify the race of the superhero who weighed 169 kg.
weighed 169 kg refers to weight_kg = 169
SELECT T2.race FROM superhero AS T1 INNER JOIN race AS T2 ON T1.race_id = T2.id WHERE T1.weight_kg = 169
757
simple
thrombosis_prediction
How many patients who were examined between 1987/7/6 and 1996/1/31 had a GPT level greater than 30 and an ALB level less than 4? List them by their ID.
examined between 1987/7/6 and 1996/1/31 refers to Date BETWEEN '1987-07-06' AND '1996-01-31'; GPT level greater than 30 refers to GPT > 30; ALB level less than 4 ALB < 4
SELECT DISTINCT ID FROM Laboratory WHERE Date BETWEEN '1987-07-06' AND '1996-01-31' AND GPT > 30 AND ALB < 4
1,187
moderate
european_football_2
What was the potiential for Francesco Parravicini on 2010/8/30?
Francesco Parravicini refers to player_name = 'Francesco Parravicini'; on 2010/8/30 refers to date = '2010-08-30 00:00:00'
SELECT t2.potential FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_api_id = t2.player_api_id WHERE SUBSTR(t2.`date`, 1, 10) = '2010-08-30' AND t1.player_name = 'Francesco Parravicini'
1,104
moderate
financial
For loans contracts which are still running where client are in debt, list the district of the and the state the percentage unemployment rate increment from year 1995 to 1996.
Unemployment increment rate in percentage = [(unemployment rate 2016 - unemployment rate 2015) / unemployment rate 2015] * 100%; unemployment rate 2015 appears in the A12; unemployment rate 2016 appears in the A13; Loan contracts which are still running where client are in debt can be presented as status = 'D'
SELECT CAST((T3.A13 - T3.A12) AS REAL) * 100 / T3.A12 FROM loan AS T1 INNER JOIN account AS T2 ON T1.account_id = T2.account_id INNER JOIN district AS T3 ON T2.district_id = T3.district_id WHERE T1.status = 'D'
125
challenging
toxicology
What is the percentage of molecules that are carcinogenic?
label = '+' mean molecules are carcinogenic; percentage = DIVIDE(SUM(label = '+'), COUNT(molecule_id)) as percent
SELECT CAST(COUNT(CASE WHEN T.label = '+' THEN T.molecule_id ELSE NULL END) AS REAL) * 100 / COUNT(T.molecule_id) FROM molecule t
227
simple
card_games
How much unconverted mana do all the cards created by Rob Alexander cost in total?
unconverted mana refer to manaCost; Rob Alexander refer to artist
SELECT SUM(manaCost) FROM cards WHERE artist = 'Rob Alexander'
398
simple
european_football_2
List the long name of teams with above-average build-up play passing in 2012.
long name of teams refers to team_long_name; build-up play passing refers to buildUpPlayPassing; above-average build-up play passing = DIVIDE(SUM(buildUpPlayPassing), COUNT(team_long_name) WHERE buildUpPlayPassing IS NOT NULL) < buildUpPlayPassing; in 2012 refers to strftime('%Y', date) = '2012';
SELECT DISTINCT t4.team_long_name FROM Team_Attributes AS t3 INNER JOIN Team AS t4 ON t3.team_api_id = t4.team_api_id WHERE SUBSTR(t3.`date`, 1, 4) = '2012' AND t3.buildUpPlayPassing > ( SELECT CAST(SUM(t2.buildUpPlayPassing) AS REAL) / COUNT(t1.id) FROM Team AS t1 INNER JOIN Team_Attributes AS t2 ON t1.team_api_id = t2.team_api_id WHERE SUBSTR(t2.`date`, 1, 4) = '2012' )
1,036
challenging
student_club
How many members of the Student_Club have majored Environmental Engineering?
'Environmental Engineering' is the major name
SELECT COUNT(T1.member_id) FROM member AS T1 INNER JOIN major AS T2 ON T1.link_to_major = T2.major_id WHERE T2.major_name = 'Environmental Engineering'
1,326
simple
financial
In the branch where the second-highest number of crimes were committed in 1995 occurred, how many male clients are there?
Male refers to gender = 'M'; A15 stands for no. of commited crimes 1995
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.A15 = (SELECT T3.A15 FROM district AS T3 ORDER BY T3.A15 DESC LIMIT 1, 1)
138
moderate
codebase_community
What is the display name of the user who last edited the post "Examples for teaching: Correlation does not mean causation"?
"Examples for teaching: Correlation does not mean causation" is the Title of post; user who last edited refers to LastEditorUserId
SELECT T2.DisplayName FROM posts AS T1 INNER JOIN users AS T2 ON T1.LastEditorUserId = T2.Id WHERE T1.Title = 'Examples for teaching: Correlation does not mean causation'
544
moderate
formula_1
Which of the Italian constructor got the highest point to date? Give its introduction website?
introduction website refers to url; Italian is a nationality
SELECT T1.url FROM constructors AS T1 INNER JOIN constructorStandings AS T2 on T1.constructorId = T2.constructorId WHERE T1.nationality = 'Italian' ORDER BY T2.points DESC LIMIT 1
983
simple
financial
What percentage of clients who opened their accounts in the district with an average salary of over 10000 are women?
Female refers to gender = 'F'; Woman and female are closed; Average salary can be found in A11
SELECT CAST(SUM(T2.gender = 'F') AS REAL) * 100 / COUNT(T2.client_id) FROM district AS T1 INNER JOIN client AS T2 ON T1.district_id = T2.district_id WHERE T1.A11 > 10000
168
moderate
financial
Please provide a list of clients who were born between 1983 and 1987 and whose account branch is in East Bohemia, along with their IDs.
SELECT T1.client_id, T3.account_id FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id INNER JOIN account AS T3 ON T2.district_id = T3.district_id WHERE T2.A3 = 'east Bohemia' AND STRFTIME('%Y', T1.birth_date) BETWEEN '1983' AND '1987'
180
moderate
codebase_community
Which users have posted the most comments. List out the user's badge?
user with the most comments refers to UserId where Max(Count(Id)
SELECT Name FROM badges AS T1 INNER JOIN comments AS T2 ON T1.UserId = t2.UserId GROUP BY T2.UserId ORDER BY COUNT(T2.UserId) DESC LIMIT 1
596
simple
card_games
What is the percentage of incredibly powerful cards in the set Coldsnap?
card set Coldsnap refers to name = 'Coldsnap'; foil is incredibly powerful refers to cardKingdomFoilId = cardKingdomId AND cardKingdomId is not null; the percentage of incredibly powerful cards in the set refers to DIVIDE(SUM(incredibly powerful), SUM(name = 'Coldsnap'))*100
SELECT CAST(SUM(CASE WHEN T1.cardKingdomFoilId IS NOT NULL AND T1.cardKingdomId IS NOT NULL THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.id) FROM cards AS T1 INNER JOIN sets AS T2 ON T2.code = T1.setCode WHERE T2.name = 'Coldsnap'
487
challenging
codebase_community
Please list the titles of the posts owned by the user csgillespie?
"csgillespie" is the DisplayName of user
SELECT T1.Title FROM posts AS T1 INNER JOIN users AS T2 ON T1.OwnerUserId = T2.Id WHERE T2.DisplayName = 'csgillespie'
538
simple
student_club
List the name of students that have attended more than 7 events.
name of students means the full name; full name refers to first_name, last_name; attended more than 7 events refers to COUNT(link_to_event) > 7
SELECT T1.first_name, T1.last_name FROM member AS T1 INNER JOIN attendance AS T2 ON T1.member_id = T2.link_to_member GROUP BY T2.link_to_member HAVING COUNT(T2.link_to_event) > 7
1,381
moderate
codebase_community
How many negative comments were given by user ID 13?
negative comments refer to Score < 60;
SELECT COUNT(Id) FROM comments WHERE UserId = 13 AND Score < 60
645
simple
codebase_community
How many posts does the user csgillespie own?
"csgillespie" is the DisplayName of user
SELECT COUNT(T1.id) FROM posts AS T1 INNER JOIN users AS T2 ON T1.OwnerUserId = T2.Id WHERE T2.DisplayName = 'csgillespie'
537
simple
codebase_community
Among the posts that were voted by user 1465, what is the id of the most valuable post?
user 1465 refers to UserId = 1465; the most valuable post refers to MAX(FavoriteCount);
SELECT T2.Id FROM votes AS T1 INNER JOIN posts AS T2 ON T1.PostId = T2.Id WHERE T1.UserId = 1465 ORDER BY T2.FavoriteCount DESC LIMIT 1
666
simple
thrombosis_prediction
Provide IDs for male patients with ALT glutamic pylvic transaminase (GPT) that have history of ALT glutamic pylvic transaminase (GPT) exceed the normal range.
male refers to SEX = 'M'; ALT glutamic pylvic transaminase (GPT) exceed the normal range refers to GPT > = 60
SELECT DISTINCT T1.ID FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T1.SEX = 'M' AND T2.GPT >= 60
1,208
moderate
debit_card_specializing
Which year recorded the most consumption of gas paid in CZK?
The first 4 strings of the values in the table yearmonth can represent year.
SELECT SUBSTRING(T2.Date, 1, 4) FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Currency = 'CZK' GROUP BY SUBSTRING(T2.Date, 1, 4) ORDER BY SUM(T2.Consumption) DESC LIMIT 1
1,479
moderate
student_club
Did Maya Mclean attend the 'Women's Soccer' event?
'Women's Soccer' is an event name
SELECT CASE WHEN T3.event_name = 'Women''s Soccer' THEN 'YES' END AS result FROM member AS T1 INNER JOIN attendance AS T2 ON T1.member_id = T2.link_to_member INNER JOIN event AS T3 ON T2.link_to_event = T3.event_id WHERE T1.first_name = 'Maya' AND T1.last_name = 'Mclean'
1,399
moderate
financial
Which district has highest active loan?
A3 refers to district names; Active loan refers to running contracts; Status = 'C' stands for running contract, OK so far; Status = 'D' stands for running contract, client in debt
SELECT T2.A3 FROM account AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id INNER JOIN loan AS T3 ON T1.account_id = T3.account_id WHERE T3.status IN ('C', 'D') GROUP BY T2.A3 ORDER BY SUM(T3.amount) DESC LIMIT 1
131
moderate
codebase_community
What is the up vote number of the user that commented "R is also lazy evaluated."?
commented "R is also lazy evaluated." refers to Text of the comment;
SELECT T2.UpVotes FROM comments AS T1 INNER JOIN users AS T2 ON T1.UserId = T2.Id WHERE T1.Text = 'R is also lazy evaluated.'
713
simple
financial
From Year 1995 to 2000, who are the accounts holders from 'east Bohemia'. State the account ID the frequency of statement issuance.
Accounts holder refers to the person who own this account.
SELECT T1.account_id, T1.frequency FROM account AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T2.A3 = 'east Bohemia' AND STRFTIME('%Y', T1.date) BETWEEN '1995' AND '2000'
120
moderate
formula_1
Who was the player that got the lap time of 0:01:27 in the race No. 161? Show his introduction website.
player and driver are synonyms; race number refers to raceId; introduction website of the drivers refers to url;
SELECT DISTINCT T2.forename, T2.surname, T2.url FROM lapTimes AS T1 INNER JOIN drivers AS T2 ON T2.driverId = T1.driverId WHERE T1.raceId = 161 AND T1.time LIKE '1:27%'
866
moderate
formula_1
In terms of number of points acquired, how many victories did the driver who ranked 91st acquired?
victories refer to wins; 91st refers to points
SELECT SUM(CASE WHEN points = 91 THEN wins ELSE 0 END) FROM driverStandings
998
simple
thrombosis_prediction
When is the latest patient's medical data recorded? This patient should have an abnormal level of lactate dehydrogenase.
latest patient refers to ID with MAX('First Date'); abnormal level of lactate dehydrogenase refers to LDH > = 500;
SELECT T1.`First Date` FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.LDH >= 500 ORDER BY T1.`First Date` DESC LIMIT 1
1,285
moderate
superhero
Find the race of the superhero who weighs 108kg and is 188cm tall.
weighs 108kg refers to weight_kg = 108; 188cm tall refers to height_cm = 188;
SELECT DISTINCT T2.race FROM superhero AS T1 INNER JOIN race AS T2 ON T1.race_id = T2.id WHERE T1.weight_kg = 108 AND T1.height_cm = 188
808
simple
superhero
What is the gender of Agent 13 hero?
Agent 13 hero refers to superhero_name = 'Agent 13';
SELECT T2.gender FROM superhero AS T1 INNER JOIN gender AS T2 ON T1.gender_id = T2.id WHERE T1.superhero_name = 'Agent 13'
777
simple
debit_card_specializing
Which LAM customer used the Euro as their currency and had the highest consumption in October 2013?
October 2013 refers to 201310 in the yearmonth.date
SELECT T1.CustomerID FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Segment = 'LAM' AND T2.Date = '201310' AND T1.Currency = 'EUR' GROUP BY T1.CustomerID ORDER BY SUM(T2.Consumption) DESC LIMIT 1
1,487
moderate
thrombosis_prediction
What is the disease name of the patient who has the highest level of triglyceride within the normal range?
disease name referse to Diagnosis; highest level of triglyceride within the normal range refers to MAX(TG < 200);
SELECT T1.Diagnosis FROM Examination AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.TG < 200 ORDER BY T2.TG DESC LIMIT 1
1,300
moderate
debit_card_specializing
For all the transactions happened during 8:00-9:00 in 2012/8/26, how many happened in CZE?
Gas station in the Czech Republic implies that Country = CZE; '2012/8/26' can be represented by '2012-08-26'
SELECT COUNT(T1.TransactionID) FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID WHERE T1.Date = '2012-08-26' AND T1.Time BETWEEN '08:00:00' AND '09:00:00' AND T2.Country = 'CZE'
1,521
moderate
european_football_2
What is the average overall rating of the players born before the year 1986?
average overall rating = DIVIDE(SUM(overall_rating), COUNT(id)); born before the year 1986 refers to strftime('%Y', birthday) < '1986';
SELECT SUM(t2.overall_rating) / COUNT(t1.id) 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'
1,093
moderate
superhero
Among the superheroes with blue eyes, how many of them have the super power of "Agility"?
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'
723
moderate
card_games
Calculate the percentage of cards in Spanish. List them by name.
Spanish refer to language; Percentage refer to DIVIDE(SUM(ID where language = 'Spanish'), COUNT(id))*100
SELECT ( SELECT CAST(SUM(CASE WHEN language = 'Spanish' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM foreign_data ), name FROM foreign_data WHERE language = 'Spanish'
403
simple
codebase_community
How many posts by Matt Parker have more than 4 votes?
more than 4 votes refer to PostId > 4; DisplayName = 'Matt Parker';
SELECT COUNT(T1.Id) FROM users AS T1 INNER JOIN postHistory AS T2 ON T1.Id = T2.UserId INNER JOIN posts AS T3 ON T2.PostId = T3.Id INNER JOIN votes AS T4 ON T4.PostId = T3.Id WHERE T1.DisplayName = 'Matt Parker' GROUP BY T2.PostId, T4.Id HAVING COUNT(T4.Id) > 4
635
moderate
card_games
What is the language and expansion type of set number 206?
set number 206 refers to id = 206
SELECT T2.language, T1.type FROM sets AS T1 INNER JOIN set_translations AS T2 ON T1.code = T2.setCode WHERE T2.id = 206
429
simple
superhero
How many female superheroes are in Marvel Comics?
female refers to gender = 'Female'; 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 INNER JOIN gender AS T3 ON T1.gender_id = T3.id WHERE T2.publisher_name = 'Marvel Comics' AND T3.gender = 'Female'
823
moderate
california_schools
What is the average writing score of the school who has the highest number of test takers whose total SAT sscores are greater or equal to 1500? Indicate the city to where the school is situated.
SELECT T1.AvgScrWrite, T2.City FROM satscores AS T1 INNER JOIN schools AS T2 ON T1.cds = T2.CDSCode ORDER BY T1.NumGE1500 DESC LIMIT 1
44
simple
financial
Name the account numbers of female clients who are oldest and have lowest average salary?
Female refers to 'F' in the gender; A11 contains information about average salary
SELECT T3.account_id FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id INNER JOIN account AS T3 ON T2.district_id = T3.district_id WHERE T1.gender = 'F' ORDER BY T1.birth_date ASC, T2.A11 ASC LIMIT 1
189
moderate
formula_1
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.
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 JULIANDAY(T1.dob) DESC LIMIT 1
1,002
moderate
student_club
State the date Connor Hilton paid his/her dues.
date the dues was paid refers to received_date where source = 'Dues'
SELECT T2.date_received FROM member AS T1 INNER JOIN income AS T2 ON T1.member_id = T2.link_to_member WHERE T1.first_name = 'Connor' AND T1.last_name = 'Hilton' AND T2.source = 'Dues'
1,357
simple