Question: How many elders obtained the "Supporter" badge?

"Supporter" is the Name of badge;  elders refers to Age > 65

SELECT COUNT(T1.Id) FROM users AS T1 INNER JOIN badges AS T2 ON T1.Id = T2.UserId WHERE T1.Age > 65 AND T2.Name = 'Supporter'


Question: Give the event ID, location, and status of events conducted from November 2019 to March 2020.

SELECT event_id, location, status FROM event WHERE date(SUBSTR(event_date, 1, 10)) BETWEEN '2019-11-01' AND '2020-03-31'


Question: How many users with more than 10 views created their account after the year 2013?

more than 10 views refers to Views > 10; created after the year 2013 refers to year (CreationDate) > 2013

SELECT COUNT(id) FROM users WHERE STRFTIME('%Y', CreationDate) > '2013' AND Views > 10


Question: Which constructor has the highest point?

SELECT T2.name FROM constructorStandings AS T1 INNER JOIN constructors AS T2 on T1.constructorId = T2.constructorId ORDER BY T1.points DESC LIMIT 1


Question: 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 = '-'


Question: What is the average number of test takers from Fresno schools that opened between 1/1/1980 and 12/31/1980?

SELECT AVG(T1.NumTstTakr) FROM satscores AS T1 INNER JOIN schools AS T2 ON T1.cds = T2.CDSCode WHERE strftime('%Y', T2.OpenDate) = '1980' AND T2.County = 'Fresno'


Question: List down Ajax's superpowers.

Ajax refers to superhero_name = 'Ajax'; superpowers refers to power_name;

SELECT T3.power_name FROM superhero AS T1 INNER JOIN hero_power AS T2 ON T1.id = T2.hero_id INNER JOIN superpower AS T3 ON T2.power_id = T3.id WHERE T1.superhero_name = 'Ajax'


Question: Please list the full names of the students in the Student_Club that come from the Art and Design Department.

full name refers to first_name, last_name;

SELECT T1.first_name, T1.last_name FROM member AS T1 INNER JOIN major AS T2 ON T1.link_to_major = T2.major_id WHERE T2.department = 'Art and Design Department'


Question: Who is the dumbest superhero?

the dumbest superhero refers to MIN(attribute_value) where attribute_name = 'Intelligence'

SELECT T1.superhero_name FROM superhero AS T1 INNER JOIN hero_attribute AS T2 ON T1.id = T2.hero_id INNER JOIN attribute AS T3 ON T2.attribute_id = T3.id WHERE T3.attribute_name = 'Intelligence' ORDER BY T2.attribute_value LIMIT 1


Question: What was Lewis Hamilton's final rank in the 2008 Chinese Grand Prix?

Lewis Hamilton refers to the full name of the driver; Full name of the driver refers to drivers.forename and drivers.surname; final rank refers to positionOrder; Chinese Grand Prix refers to races.name = 'Chinese Grand Prix';

SELECT T2.positionOrder FROM races AS T1 INNER JOIN results AS T2 ON T2.raceId = T1.raceId INNER JOIN drivers AS T3 ON T3.driverId = T2.driverId WHERE T3.forename = 'Lewis' AND T3.surname = 'Hamilton' AND T1.name = 'Chinese Grand Prix' AND T1.year = 2008


Question: Give me the molecule ID of the double bond type.

double bond refers to bond_type = ' = ';

SELECT DISTINCT T.molecule_id FROM bond AS T WHERE T.bond_type = '='


Question: 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'


Question: What's the nationality of the customer who spent 548.4 in 2012/8/24?

SELECT T2.Country FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID WHERE T1.Date = '2012-08-24' AND T1.Price = 548.4


Question: Which event has the highest budget amount?

event refers to event_name; highest budget amount refers to MAX(amount)

SELECT T2.event_name FROM budget AS T1 INNER JOIN event AS T2 ON T1.link_to_event = T2.event_id ORDER BY T1.amount DESC LIMIT 1


Question: For the patients with an abnormal activated partial prothrom bin time, how many of them does not have thrombosis?

abnormal activated partial prothrom bin time refers to APTT > 45; does not have thrombosis refers to Thrombosis = 0; 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 = 0 AND T2.APTT > 45


Question: What was the notes of the fundraising on 2019/9/14?

fundraising on 2019/9/14 refers to source = 'Fundraising' where date_received = '2019-09-14'

SELECT notes FROM income WHERE source = 'Fundraising' AND date_received = '2019-09-14'


Question: What's the location coordinates of Silverstone Circuit?

location coordinates refers to (lat, lng); Silverstone Circuit refers to circuits.name = 'Silverstone Circuit'

SELECT lat, lng FROM circuits WHERE name = 'Silverstone Circuit'


Question: For all the transactions happened during 8:00-9:00 in 2012/8/26, how many happened in CZE?

Czech Republic can be represented as the Country value in the gasstations table is 'CZE'; '2012/8/26' can be represented by '2012-08-26'; during 8:00-9:00 can be represented as Time BETWEEN '08:00:00' AND '09:00:00'

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'


Question: How many football players born after the 1990s have the first name "Aaron"?

first name "Aaron" refers to player_name LIKE 'Aaron%'; born after the 1990s refers to birthday > '1990'

SELECT COUNT(id) FROM Player WHERE birthday > '1990' AND player_name LIKE 'Aaron%'


Question: Who is the editor of the post titled 'Open source tools for visualizing multi-dimensional data?'

'Open source tools for visualizing multi-dimensional data' is the Title of Post; editor refers to DisplayName;

SELECT T2.DisplayName FROM posts AS T1 INNER JOIN users AS T2 ON T1.OwnerUserId = T2.Id WHERE T1.Title = 'Open source tools for visualizing multi-dimensional data?'


Question: What is the average fastest lap time of the top 10 drivers in the 2006 United States Grand Prix?

top 10 refers to rank <11; AVG(fastestLapTime);

SELECT AVG(T1.fastestLapTime) FROM results AS T1 INNER JOIN races AS T2 on T1.raceId = T2.raceId WHERE T1.rank < 11 AND T2.year = 2006 AND T2.name = 'United States Grand Prix'


Question: For the set of cards with "Ancestor's Chosen" in it, is there a Korean version of it?

set of cards with "Ancestor''s Chosen" in it refers to name = 'Ancestor''s Chosen'; Korean version refers to language = 'Korean'

SELECT IIF(SUM(CASE WHEN T2.language = 'Korean' AND T2.translation IS NOT NULL THEN 1 ELSE 0 END) > 0, 'YES', 'NO') FROM cards AS T1 INNER JOIN set_translations AS T2 ON T2.setCode = T1.setCode WHERE T1.name = 'Ancestor''s Chosen'


Question: Which active district has the highest average score in Reading?

SELECT T1.District FROM schools AS T1 INNER JOIN satscores AS T2 ON T1.CDSCode = T2.cds WHERE T1.StatusType = 'Active' ORDER BY T2.AvgScrRead DESC LIMIT 1


Question: How many accidents did the driver who had the highest number accidents in the Canadian Grand Prix have?

number of accidents refers to the number where statusid = 3; Canadian Grand Prix refers to the race of name

SELECT COUNT(T1.driverId) FROM results AS T1 INNER JOIN races AS T2 on T1.raceId = T2.raceId INNER JOIN status AS T3 on T1.statusId = T3.statusId WHERE T3.statusId = 3 AND T2.name = 'Canadian Grand Prix' GROUP BY T1.driverId ORDER BY COUNT(T1.driverId) DESC LIMIT 1


Question: Tell the phone number of "Carlo Jacobs".

Carlo Jacobs is the full name; full name refers to first_name, last_name;

SELECT phone FROM member WHERE first_name = 'Carlo' AND last_name = 'Jacobs'


Question: What is the coordinates location of the circuits for Australian grand prix?

coordinate position/location refers to lat, lng; circuits for Australian grand prix refers to races.name = 'Australian Grand Prix'

SELECT DISTINCT T1.lat, T1.lng FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T2.name = 'Australian Grand Prix'


Question: Mention the display name and location of the user who owned the excerpt post with hypothesis-testing tag.

user who owned the excerpt post with hypothesis-testing tag refers to OwnerUserId WHERE TagName = 'hypothesis-testing';

SELECT T3.DisplayName, T3.Location FROM tags AS T1 INNER JOIN posts AS T2 ON T1.ExcerptPostId = T2.Id INNER JOIN users AS T3 ON T3.Id = T2.OwnerUserId WHERE T1.TagName = 'hypothesis-testing'


Question: List the top 10 players' names whose heights are above 180 in descending order of average heading accuracy.

heights are above 180 refers to Player.height > 180; average heading accuracy = DIVIDE(SUM(heading_accuracy), COUNT(player_fifa_api_id));

SELECT t1.player_name FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_api_id = t2.player_api_id WHERE t1.height > 180 GROUP BY t1.id ORDER BY CAST(SUM(t2.heading_accuracy) AS REAL) / COUNT(t2.`player_fifa_api_id`) DESC LIMIT 10


Question: What is the average of superheroes with no skin colour?

average = DIVIDE(COUNT(superhero.id), SUM(skin_colour_id = 1)); no skin colour refers to skin_colour_id WHERE colour.id = 1;

SELECT CAST(COUNT(*) AS REAL) / SUM(CASE WHEN T2.id = 1 THEN 1 ELSE 0 END) FROM superhero AS T1 INNER JOIN colour AS T2 ON T1.skin_colour_id = T2.id


Question: Please list the patient's ID if he or she has an abnormal level of red blood cell and is followed at the outpatient clinic.

RBC < = 3.5 or RBC > = 6.0 means the patient has an abnormal level of red blood cell; 3.5 < RBC < 6.0 means the patient has a normal level of red blood cell; followed at the outpatient clinic refers to Admission = '-';

SELECT DISTINCT T1.ID FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE (T2.RBC <= 3.5 OR T2.RBC >= 6) AND T1.Admission = '-'


Question: For the customer who paid 634.8 in 2012/8/25, what was the consumption decrease rate from Year 2012 to 2013?

'2012/8/24' can be represented by '2012-08-24'; Consumption decrease rate = (consumption_2012 - consumption_2013) / consumption_2012

SELECT CAST(SUM(IIF(SUBSTR(Date, 1, 4) = '2012', Consumption, 0)) - SUM(IIF(SUBSTR(Date, 1, 4) = '2013', Consumption, 0)) AS FLOAT) / SUM(IIF(SUBSTR(Date, 1, 4) = '2012', Consumption, 0)) FROM yearmonth WHERE CustomerID = ( SELECT T1.CustomerID FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID WHERE T1.Date = '2012-08-25' AND T1.Price = 634.8 )


Question: Which superheroes have a durability attribute value of less than 50?

durability of less than 50 refers to attribute_name = 'Durability' AND attribute_value < 50

SELECT superhero_name FROM superhero AS T1 WHERE EXISTS (SELECT 1 FROM hero_attribute AS T2 INNER JOIN attribute AS T3 ON T2.attribute_id = T3.id WHERE T3.attribute_name = 'Durability' AND T2.attribute_value < 50 AND T1.id = T2.hero_id)


Question: What is the fastest lap number of the champion in 2009?

in 2009 refers to year = 2009; Only the time of the champion shows in the format of "hour: minutes: seconds.millionsecond"

SELECT T1.fastestLap FROM results AS T1 INNER JOIN races AS T2 on T1.raceId = T2.raceId WHERE T2.year = 2009 AND T1.time LIKE '_:%:__.___'


Question: How old is the youngest Japanese driver? What is his name?

date of birth refers to drivers.dob; The larger the birthday value, the younger the person is, and vice versa; Japanese refers to nationality = 'Japanese'; age = YEAR(CURRENT_TIMESTAMP) - YEAR(dob);

SELECT STRFTIME('%Y', CURRENT_TIMESTAMP) - STRFTIME('%Y', dob), forename , surname FROM drivers WHERE nationality = 'Japanese' ORDER BY dob DESC LIMIT 1


Question: Please provide links to events for members who have paid more than 50 dollar.

have paid more than 50 dollar refers to cost > 50

SELECT DISTINCT T3.link_to_event FROM expense AS T1 INNER JOIN member AS T2 ON T1.link_to_member = T2.member_id INNER JOIN attendance AS T3 ON T2.member_id = T3.link_to_member WHERE T1.cost > 50


Question: 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'


Question: Among the molecules between TR004 to TR010, how many of them has single bonds?

single bond refers to bond_type = '-'; molecules between TR004 to TR010 refers molecule_id BETWEEN 'TR004' and 'TR010';

SELECT COUNT(DISTINCT T.molecule_id) FROM bond AS T WHERE T.molecule_id BETWEEN 'TR004' AND 'TR010' AND T.bond_type = '-'


Question: Tell the hometown county for "Adela O'Gallagher".

SELECT T2.county FROM member AS T1 INNER JOIN zip_code AS T2 ON T1.zip = T2.zip_code WHERE T1.first_name = 'Adela' AND T1.last_name = 'O''Gallagher'


Question: 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'


Question: How many 'classic' cards are eligible for loan?

when the account type = 'OWNER', it's eligible for loan

SELECT COUNT(T1.card_id) FROM card AS T1 INNER JOIN disp AS T2 ON T1.disp_id = T2.disp_id WHERE T1.type = 'classic' AND T2.type = 'OWNER'


Question: What are the elements of the toxicology and label of molecule TR060?

SELECT DISTINCT T1.element, T2.label FROM atom AS T1 INNER JOIN molecule AS T2 ON T1.molecule_id = T2.molecule_id WHERE T2.molecule_id = 'TR060'


Question: Name the atoms' elements that form bond TR000_2_3.

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 = 'TR000_2_3'


Question: What is the average monthly number of links created in 2010 for posts that have no more than 2 answers?

calculation = DIVIDE(COUNT(Id where YEAR(CreationDate) = 2010 and AnswerCount < = 2), 12)

SELECT CAST(COUNT(T1.Id) AS REAL) / 12 FROM postLinks AS T1 INNER JOIN posts AS T2 ON T1.PostId = T2.Id WHERE T2.AnswerCount <= 2 AND STRFTIME('%Y', T1.CreationDate) = '2010'


Question: 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'


Question: 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'


Question: How many single bonds are there in the list?

SELECT COUNT(T.bond_id) FROM bond AS T WHERE T.bond_type = '-'


Question: How many types of cards does the artist Aaron Boyd illustrated about card art?

SELECT COUNT(type) FROM cards WHERE artist = 'Aaron Boyd'


Question: Who finished second in the San Marino Grand Prix in 2006?

SELECT T3.forename, T3.surname FROM races AS T1 INNER JOIN results AS T2 ON T2.raceId = T1.raceId INNER JOIN drivers AS T3 ON T3.driverId = T2.driverId WHERE T1.year = 2006 AND T1.name = 'San Marino Grand Prix' AND T2.position = 2


Question: Find the full name, Wiki Pedia page link, and date of birth of German drivers born between 1971 and 1985. List it in descending order of date of birth.

FFull name refers to forname+surname; Nationality refers to German; Date of birth refers to dob; year(dob) BETWEEN '1971' AND '1985'

SELECT forename, surname, url, dob FROM drivers WHERE nationality = 'German' AND STRFTIME('%Y', dob) BETWEEN '1971' AND '1985' ORDER BY dob DESC


Question: For the branch which located in the south Bohemia with biggest number of inhabitants, what is the percentage of the male clients?

Percentage of the male clients = DIVIDE(COUNT(male clients), COUNT(clients)) * 100; Male refers to gender = 'M', A3 is the region name. A4 contains the information about inhabitants.

SELECT CAST(SUM(T1.gender = 'M') AS REAL) * 100 / COUNT(T1.client_id) FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T2.A3 = 'south Bohemia' GROUP BY T2.A4 ORDER BY T2.A4 DESC LIMIT 1


Question: What is the percentage of female patient had total protein not within the normal range?

female refers to sex = 'F'; total protein not within the normal range refers to TP < '6.0' or TP > '8.5'; calculation = DIVIDE((ID where sex = 'F' and TP < '6.0' or TP > '8.5'), COUNT(ID)) * 100

SELECT CAST(SUM(CASE WHEN T1.SEX = 'F' AND (T2.TP < 6.0 OR T2.TP > 8.5) THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T1.SEX = 'F'


Question: 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 refers to language = 'Chinese Simplified'; 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'


Question: List all the elements of atoms that can not bond with any other atoms.

atoms cannot bond with other atoms means atom_id NOT in connected table;

SELECT DISTINCT T.element FROM atom AS T WHERE T.element NOT IN ( SELECT DISTINCT T1.element FROM atom AS T1 INNER JOIN connected AS T2 ON T1.atom_id = T2.atom_id )


Question: List all the elements of the toxicology of the molecule "TR004".

SELECT DISTINCT T.element FROM atom AS T WHERE T.molecule_id = 'TR004'


Question: What is the description about the ruling of card "Condemn"?

Ancestor's Chosen' is the name of card; description about the ruling refers to text;

SELECT T2.text FROM cards AS T1 INNER JOIN rulings AS T2 ON T1.uuid = T2.uuid WHERE T1.name = 'Condemn'


Question: How many views did the post titled 'Integration of Weka and/or RapidMiner into Informatica PowerCenter/Developer' get?

"Integration of Weka and/or RapidMiner into Informatica PowerCenter/Developer" is the Title of post; views refers to ViewCount

SELECT ViewCount FROM posts WHERE Title = 'Integration of Weka and/or RapidMiner into Informatica PowerCenter/Developer'


Question: List the football players with a birthyear of 1970 and a birthmonth of October.

players with a birthyear of 1970 and a birthmonth of October refers to substr(birthday,1,7) AS 'year-month',WHERE year = '1970' AND month = '10';

SELECT player_name FROM Player WHERE SUBSTR(birthday, 1, 7) = '1970-10'


Question: What's the German type of the card "Ancestor's Chosen"?

German refers to language = 'German'; "Ancestor's Chosen" refers to name = 'Ancestor''s Chosen'

SELECT DISTINCT T1.type FROM cards AS T1 INNER JOIN foreign_data AS T2 ON T2.uuid = T1.uuid WHERE T1.name = 'Ancestor''s Chosen' AND T2.language = 'German'


Question: List and group all patients by sex for total bilirubin (T-BIL) level not within the normal range.

List refers to GROUP_CONCAT(DISTINCT ID); total bilirubin (T-BIL) not within normal range refers to T-BIL > = 2.0

SELECT T1.ID,T1.SEX FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.`T-BIL` >= 2.0 GROUP BY T1.SEX,T1.ID


Question: What elements are in a double type bond?

double type bond refers to bond_type = '=';

SELECT DISTINCT T1.element FROM atom AS T1 INNER JOIN bond AS T2 ON T1.molecule_id = T2.molecule_id INNER JOIN connected AS T3 ON T1.atom_id = T3.atom_id WHERE T2.bond_type = '='


Question: Among black card borders, which card has full artwork?

white card borders refers to borderColor = 'white'; has full artwork refers to isFullArt = 1

SELECT id FROM cards WHERE borderColor = 'black' AND isFullArt = 1


Question: What was the average overall rating for Marko Arnautovic from 2007/2/22 to 2016/4/21?

average overall rating refers to avg(overall_rating); Marko Arnautovic refers to player_name = 'Marko Arnautovic'; from 2007/2/22 to 2016/4/21 refers to the first 10 characters of date BETWEEN '2007-02-22' and '2016-04-21'

SELECT CAST(SUM(t2.overall_rating) AS REAL) / COUNT(t2.id) FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_fifa_api_id = t2.player_fifa_api_id WHERE t1.player_name = 'Marko Arnautovic' AND SUBSTR(t2.`date`, 1, 10) BETWEEN '2007-02-22' AND '2016-04-21'


Question: Please list the exact dates on which a Formula_1 race took place on the Barcelona-Catalunya circuit.

SELECT T2.date FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T1.name = 'Circuit de Barcelona-Catalunya'


Question: How many white bordered cards are powerful?

white bordered cards refer to borderColor = 'white'; powerful cards refers to cardKingdomFoilId is not null AND cardKingdomId is not null (replace)

SELECT COUNT(id) FROM cards WHERE borderColor = 'white' AND cardKingdomId IS NOT NULL AND cardKingdomFoilId IS NOT NULL


Question: For patients with severe degree of thrombosis, list their ID, sex and disease the patient is diagnosed with.

severe degree of thrombosis refers to thrombosis = 2; disease refers to diagnosis;

SELECT DISTINCT T1.ID, T1.SEX, T1.Diagnosis FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID WHERE T2.Thrombosis = 2


Question: List all patients who were born in 1937 whose total cholesterol was beyond the normal range.

who were born in 1937 refers to year(birthday) = '1937'; total cholesterol was beyond the normal range refers to `T-CHO` > = '250'

SELECT DISTINCT T1.ID FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE STRFTIME('%Y', T1.Birthday) = '1937' AND T2.`T-CHO` >= 250


Question: 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 = '-'


Question: 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 is not null 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'


Question: What is the total budgeted amount for all category in "October Speaker" event?

total budgeted amount refers to SUM(amount) where event_name = 'October Speaker'

SELECT SUM(T2.amount) FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event WHERE T1.event_name = 'October Speaker'


Question: What is the most common bond type?

most common bond type refers MAX(COUNT(bond_type))

SELECT T.bond_type FROM ( SELECT bond_type, COUNT(bond_id) FROM bond GROUP BY bond_type ORDER BY COUNT(bond_id) DESC LIMIT 1 ) AS T


Question: Provide the badge names received in 2011 for the user whose location is in the North Pole.

received in 2011 refers to year(Date) = 2011;

SELECT T2.Name FROM users AS T1 INNER JOIN badges AS T2 ON T1.Id = T2.UserId WHERE STRFTIME('%Y', T2.Date) = '2011' AND T1.Location = 'North Pole'


Question: 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'


Question: What is the publisher for Hawkman, Karate Kid and Speedy?

publisher refers to publisher_name; Hawkman refers to superhero_name = 'Hawkman'; Karate Kid refers to superhero_name = 'Karate Kid'; Speedy refers to superhero_name = 'Speedy';

SELECT T2.publisher_name FROM superhero AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.id WHERE T1.superhero_name IN ('Hawkman', 'Karate Kid', 'Speedy')


Question: Which driver ranked the first in the Canadian Grand Prix in 2007? Please give his reference name.

reference name refers to driverRef; Canadian Grand Prix refers to races.name = 'Canadian Grand Prix';

SELECT T3.forename, T3.surname, T3.driverRef FROM races AS T1 INNER JOIN results AS T2 ON T2.raceId = T1.raceId INNER JOIN drivers AS T3 ON T3.driverId = T2.driverId WHERE T1.name = 'Canadian Grand Prix' AND T2.rank = 1 AND T1.year = 2007


Question: State the detailed content of the comment which was created on 7/19/2010 7:25:47 PM.

detailed content of the comment refers to Text; created on 7/19/2010 7:16:14 PM refers to CreationDate = '2010-07-19 19:16:14.0'

SELECT Text FROM comments WHERE CreationDate = '2010-07-19 19:16:14.0'


Question: What is the full name and date of birth of Austrian drivers born between 1981 and 1991?

Full name refers to forname, surname; Date of birth refers to dob; year(dob) BETWEEN '1981' AND '1991'; Austrian is a nationality

SELECT forename, surname, dob FROM drivers WHERE nationality = 'Austrian' AND STRFTIME('%Y', dob) BETWEEN '1981' AND '1991'


Question: Name all cards with 2015 frame style ranking below 100 on EDHRec.

below 100 on EDHRec refers to EDHRec <100; with 2015 frame style refers to frameVersion = 2015;

SELECT id FROM cards WHERE edhrecRank < 100 AND frameVersion = 2015


Question: 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


Question: Please provide the IDs of the 3 female clients with the largest loans.

SELECT T1.client_id FROM client AS T1 INNER JOIN disp AS T4 on T1.client_id= T4.client_id INNER JOIN account AS T2 ON T4.account_id = T2.account_id  INNER JOIN loan AS T3 ON T2.account_id = T3.account_id and T4.account_id = T3.account_id WHERE T1.gender = 'F' ORDER BY T3.amount DESC LIMIT 3


Question: For the drivers who took part in the race in 1983/7/16, what's their race completion rate?

DIVIDE(COUNT(driverid when time has value ), (COUNT(driverid )) as percentage; in 1983/7/16 refers to when date = '1983-07-16'

SELECT CAST(COUNT(CASE WHEN T2.time IS NOT NULL THEN T2.driverId END) AS REAL) * 100 / COUNT(T2.driverId) FROM races AS T1 INNER JOIN results AS T2 ON T2.raceId = T1.raceId WHERE T1.date = '1983-07-16'


Question: What was the longest time a driver had ever spent at a pit stop?

longest time spent at pitstop refers to MAX(duration)

SELECT duration FROM pitStops ORDER BY duration DESC LIMIT 1


Question: Which cards are ranked 1st on EDHRec? List all of the cards name and its banned play format.

ranked 1st on EDHRec refers to edhrecRank = 1; banned refers to status = 'Banned'; play format refers to format; cards name refers to name

SELECT T1.name, T2.format FROM cards AS T1 INNER JOIN legalities AS T2 ON T2.uuid = T1.uuid WHERE T1.edhrecRank = 1 AND T2.status = 'Banned' GROUP BY T1.name, T2.format


Question: What is the highest monthly consumption in the year 2012?

The first 4 strings of the Date values in the yearmonth table can represent year; The 5th and 6th string of the date can refer to month.

SELECT SUM(Consumption) FROM yearmonth WHERE SUBSTR(Date, 1, 4) = '2012' GROUP BY SUBSTR(Date, 5, 2) ORDER BY SUM(Consumption) DESC LIMIT 1


Question: Please give the link of the website that shows more information about the circuits the Spanish Grand Prix used in 2009.

SELECT T1.url FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T2.year = 2009 AND T2.name = 'Spanish Grand Prix'


Question: Which user added a bounty amount of 50 to the post title mentioning variance?

bounty amount of 50 refers to BountyAmount = 50; user refers to DisplayName; title mentioning variance refers to Title include 'variance'

SELECT T3.DisplayName, T1.Title FROM posts AS T1 INNER JOIN votes AS T2 ON T1.Id = T2.PostId INNER JOIN users AS T3 ON T3.Id = T2.UserId WHERE T2.BountyAmount = 50 AND T1.Title LIKE '%variance%'


Question: 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


Question: 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 = '*')


Question: 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


Question: Please list top three elements of the toxicology of the molecule TR000 in alphabetical order.

SELECT DISTINCT T.element FROM atom AS T WHERE T.molecule_id = 'TR000' ORDER BY T.element LIMIT 3


Question: What are the cards that only available in paper and Japanese language?

available in paper refers to availability = 'paper'; 'Japanese is the language;

SELECT T1.name FROM cards AS T1 INNER JOIN foreign_data AS T2 ON T1.uuid = T2.uuid WHERE T1.availability = 'paper' AND T2.language = 'Japanese'


Question: Which of the play format has the highest number of banned status? Indicate the play format and the names of all the card meet the condition.

play format refers to format; banned status refers to status = 'Banned'; the highest number of banned status refers to MAX(COUNT(status = 'Banned'))

WITH MaxBanned AS (SELECT format, COUNT(*) AS count_banned FROM legalities WHERE status = 'Banned' GROUP BY format ORDER BY COUNT(*) DESC LIMIT 1) SELECT T2.format, T1.name FROM cards AS T1 INNER JOIN legalities AS T2 ON T2.uuid = T1.uuid INNER JOIN MaxBanned MB ON MB.format = T2.format WHERE T2.status = 'Banned'


Question: Mention the total expense used on 8/20/2019.

total expense refers SUM(cost) where expense_date = '2019-08-20'

SELECT SUM(cost) FROM expense WHERE expense_date = '2019-08-20'


Question: Provide the name of superhero with superhero ID 294.

name of superhero refers to superhero_name; superhero ID 294 refers to superhero.id = 294;

SELECT superhero_name FROM superhero WHERE id = 294


Question: Calculate the percentage of members who are major Business in the list?

DIVIDE(SUM(position = 'Member' and major_name = 'Business'), COUNT(member_id)) * 100

SELECT CAST(SUM(CASE WHEN T2.major_name = 'Business' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.member_id) FROM member AS T1 INNER JOIN major AS T2 ON T2.major_id = T1.link_to_major WHERE T1.position = 'Member'


Question: 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'


Question: Among the customers who paid in euro, how many of them have a monthly consumption of over 1000?

SELECT COUNT(*) FROM yearmonth AS T1 INNER JOIN customers AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.Currency = 'EUR' AND T1.Consumption > 1000.00


Question: What is the score and the link type ID for post ID 395?

SELECT T1.Score, T2.LinkTypeId FROM posts AS T1 INNER JOIN postLinks AS T2 ON T1.Id = T2.PostId WHERE T2.PostId = 395


Question: 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'


Question: For the patients with an abnormal anti-SM, please list the IDs of the three youngest ones.

abnormal anti-SM refers to SM NOT IN ('negative', '0'); youngest refers to MAX(Birthday);

SELECT T1.ID FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.SM NOT IN ('negative','0') ORDER BY T1.Birthday DESC LIMIT 3


Question: 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'


Question: Which post has the highest score? Please give its id and title's name.

the highest score refers to MAX(Score); owner's name refers to DisplayName;

SELECT T1.Id, T2.Title FROM users AS T1 INNER JOIN posts AS T2 ON T1.Id = T2.OwnerUserId ORDER BY T2.Score DESC LIMIT 1


Question: How many posts were created by Daniel Vassallo?

SELECT COUNT(T1.Id) FROM users AS T1 INNER JOIN postHistory AS T2 ON T1.Id = T2.UserId WHERE T1.DisplayName = 'Daniel Vassallo'


Question: How was the build up play dribbling class for "LEI" on 2015/9/10?

"LEI" refers to team_short_name = 'LEI'; on 2015/9/10 refers to  date = '2015-09-10 00:00:00'

SELECT t2.buildUpPlayDribblingClass FROM Team AS t1 INNER JOIN Team_Attributes AS t2 ON t1.team_api_id = t2.team_api_id WHERE t1.team_short_name = 'LEI' AND SUBSTR(t2.`date`, 1, 10) = '2015-09-10'


Question: How many gold-eyed superheroes did Marvel Comics publish?

gold-eyed refers to colour = 'Gold' where eye_colour_id = colour.id; superheroes that Marvel Comics published refers to publisher_name = 'Marvel Comics'

SELECT COUNT(T1.id) FROM superhero AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.id INNER JOIN colour AS T3 ON T1.eye_colour_id = T3.id WHERE T2.publisher_name = 'Marvel Comics' AND T3.colour = 'Gold'


Question: What is the percentage of loan amount that has been fully paid with no issue.

Loan paid with no issue means contract finished, no problems; status = 'A' means contract finished, no problems; Percentage of accounts by condition = [(total(amount) & condition) / (total amount)] * 100%

SELECT (CAST(SUM(CASE WHEN status = 'A' THEN amount ELSE 0 END) AS REAL) * 100) / SUM(amount) FROM loan


Question: How many members of the Student_Club have major in 'Physics Teaching'?

SELECT COUNT(T2.member_id) FROM major AS T1 INNER JOIN member AS T2 ON T1.major_id = T2.link_to_major WHERE T1.major_name = 'Physics Teaching'


Question: How many majors are there in "College of Humanities and Social Sciences"?

SELECT COUNT(major_name) FROM major WHERE college = 'College of Humanities and Social Sciences'


Question: 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'


Question: What is the sum that client number 4's account has following transaction 851? Who owns this account, a man or a woman?

SELECT T4.balance, T1.gender FROM client AS T1 INNER JOIN disp AS T2 ON T1.client_id = T2.client_id INNER JOIN account AS T3 ON T2.account_id =T3.account_id INNER JOIN trans AS T4 ON T3.account_id = T4.account_id WHERE T1.client_id = 4 AND T4.trans_id = 851


Question: Which user ID has the highest reputation?

highest reputation refers to Max(Reputation)

SELECT Id FROM users WHERE Reputation = ( SELECT MAX(Reputation) FROM users )


Question: List the hero ID of superheroes have intellegence as their power.

hero ID refers to superhero.id; have intelligence as their power refers to power_name = 'Intelligence';

SELECT T1.hero_id FROM hero_power AS T1 INNER JOIN superpower AS T2 ON T1.power_id = T2.id WHERE T2.power_name = 'Intelligence'


Question: Which client issued his/her card in 1994/3/3, give his/her client id.

SELECT T2.client_id FROM client AS T1 INNER JOIN disp AS T2 ON T1.client_id = T2.client_id INNER JOIN card AS T3 ON T2.disp_id = T3.disp_id WHERE T3.issued = '1994-03-03'


Question: How many accounts were opened in Litomerice in 1996?

A2 refers to district name; Litomerice is one of district names.

SELECT COUNT(T2.account_id) FROM district AS T1 INNER JOIN account AS T2 ON T1.district_id = T2.district_id WHERE STRFTIME('%Y', T2.date) = '1996' AND T1.A2 = 'Litomerice'


Question: State the racing year which has the fastest lap time?

'has the fastest lap time?' refers to fastestLapTime has values

SELECT T2.year FROM results AS T1 INNER JOIN races AS T2 on T1.raceId = T2.raceId WHERE T1.fastestLapTime IS NOT NULL


Question: What are the foiled cards that are incredibly powerful when paired with non foiled cards? List the IDs.

Incredibly powerful refers to both cardKingdomFoilId and cardKingdomId IS NOT Null;

SELECT id FROM cards WHERE cardKingdomId IS NOT NULL AND cardKingdomFoilId IS NOT NULL


Question: Locate players with vision scores of 90 and above, state the country of these players.

vision scores of 90 and above refers to vision > 89

SELECT DISTINCT t4.name FROM Player_Attributes AS t1 INNER JOIN Player AS t2 ON t1.player_api_id = t2.player_api_id INNER JOIN Match AS t3 ON t2.player_api_id = t3.home_player_8 INNER JOIN Country AS t4 ON t3.country_id = t4.id WHERE t1.vision > 89


Question: How many patients who underwent testing in 1997 had protein levels outside the normal range?

underwent testing in 1997 refers to YEAR(DATE) = '1997'; protein levels within the normal range refers to tp > 6 and tp < 8.5

SELECT COUNT(ID) FROM Laboratory WHERE (ALB <= 6.0 OR ALB >= 8.5) AND STRFTIME('%Y', Date) = '1997'


Question: List the driver's ID of the top five driver, by descending order, the fastest time during the first lap of the race.

SELECT driverId FROM lapTimes WHERE lap = 1 ORDER BY time LIMIT 5


Question: How many drivers managed to finish the race in the 2008 Australian Grand Prix?

managed to finish the race refers to time is not null

SELECT COUNT(T2.driverId) FROM races AS T1 INNER JOIN results AS T2 ON T2.raceId = T1.raceId WHERE T1.name = 'Australian Grand Prix' AND T1.year = 2008 AND T2.time IS NOT NULL


Question: In the events with more than forty incomes, list the city and country in which the event is happening.

more than fifty incomes refers to income > 40

SELECT DISTINCT T3.city, T3.county FROM income AS T1 INNER JOIN member AS T2 ON T1.link_to_member = T2.member_id INNER JOIN zip_code AS T3 ON T3.zip_code = T2.zip WHERE T1.amount > 40


Question: 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


Question: Who has the highest average finishing rate between the highest and shortest football player?

finishing rate refers to finishing; highest average finishing rate = MAX(AVG(finishing)); highest football player refers to MAX(height); shortest football player refers to MIN(height);

SELECT A FROM ( SELECT AVG(finishing) result, 'Max' A FROM Player AS T1 INNER JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T1.height = ( SELECT MAX(height) FROM Player ) UNION SELECT AVG(finishing) result, 'Min' A FROM Player AS T1 INNER JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T1.height = ( SELECT MIN(height) FROM Player ) ) ORDER BY result DESC LIMIT 1


Question: Among the users who obtained the "Organizer" badges, calculate the percentage of users who are teenagers.

"Organizer" is the Name of badge; teenager refers to Age BETWEEN 13 AND 18; percentage = Divide (Count(UserId where Age BETWEEN 13 AND 18), Count(UserId)) *100

SELECT CAST(SUM(IIF(T2.Age BETWEEN 13 AND 18, 1, 0)) AS REAL) * 100 / COUNT(T1.Id) FROM badges AS T1 INNER JOIN users AS T2 ON T1.UserId = T2.Id WHERE T1.`Name` = 'Organizer'


Question: How much did customer 6 consume in total between August and November 2013?

Between August And November 2013 refers to Between 201308 And 201311; The first 4 strings of the Date values in the yearmonth table can represent year; The 5th and 6th string of the date can refer to month.

SELECT SUM(Consumption) FROM yearmonth WHERE CustomerID = 6 AND Date BETWEEN '201308' AND '201311'


Question: What is the name of the football league in the country of Netherlands?

name of the football league refers to League.name;

SELECT t2.name FROM Country AS t1 INNER JOIN League AS t2 ON t1.id = t2.country_id WHERE t1.name = 'Netherlands'


Question: When did the first-through-twelfth-grade school with the largest enrollment open?

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


Question: What is the status of card "Cloudchaser Eagle"?

SELECT DISTINCT T2.status FROM cards AS T1 INNER JOIN legalities AS T2 ON T1.uuid = T2.uuid WHERE T1.name = 'Cloudchaser Eagle'


Question: List out the position of members who joined major of Business.

SELECT T2.position FROM major AS T1 INNER JOIN member AS T2 ON T1.major_id = T2.link_to_major WHERE T1.major_name = 'Business'


Question: For patient born between 1936-1956, how many male patients have creatinine phosphokinase beyond the normal range?

born between 1936-1956 refers to year(Birthday) BETWEEN '1936' AND '1956'; male patients refers to sex = 'M'; creatinine phosphokinase beyond the normal range refers to CPK > = 250; Should consider DISTINCT in the final result;

SELECT COUNT(DISTINCT T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE STRFTIME('%Y', T1.Birthday) BETWEEN '1936' AND '1956' AND T1.SEX = 'M' AND T2.CPK >= 250


Question: Please list the name of the districts with accounts that made withdrawal transactions.

A2 refers to district name; type = 'VYDAJ' stands for withdrawal transactions

SELECT DISTINCT T1.A2 FROM district 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 T3.type = 'VYDAJ'


Question: What is the overall rating of the football player Gabriel Tamas in year 2011?

in year 2011 refers to strftime('%Y', date) = '2011';

SELECT t2.overall_rating FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_api_id = t2.player_api_id WHERE t1.player_name = 'Gabriel Tamas' AND strftime('%Y', t2.date) = '2011'


Question: Is it true that more SMEs pay in Czech koruna than in euros? If so, how many more?

Amount of more SMEs = Total of SMEs pay using Currency CZK - Total of SMEs pay using Currency EUR

SELECT SUM(Currency = 'CZK') - SUM(Currency = 'EUR') FROM customers WHERE Segment = 'SME'


Question: What is the average of fastest lap speed in the 2009 Spanish Grand Prix race?

Spanish Grand Prix is the name of race refers to name = 'Spanish Grand Prix'; average fastest lap speed refers to avg(fastestLapSpeed);

SELECT AVG(T1.fastestLapSpeed) FROM results AS T1 INNER JOIN races AS T2 on T1.raceId = T2.raceId WHERE T2.year = 2009 AND T2.name = 'Spanish Grand Prix'


Question: What's the reference name of Marina Bay Street Circuit?

reference name refers to circuitRef; Marina Bay Street Circuit refers to circuits.name = 'Marina Bay Street Circuit'

SELECT circuitRef FROM circuits WHERE name = 'Marina Bay Street Circuit'


Question:
How many matches were held in the league Germany 1. Bundesliga
from August to October 2008?

Germany 1. Bundesliga refers to League.name = 'Germany 1. Bundesliga'; from August to October 2008 refers to strftime('%Y-%m', date) BETWEEN '2008-08' AND '2008-10';

SELECT COUNT(t2.id) FROM League AS t1 INNER JOIN Match AS t2 ON t1.id = t2.league_id WHERE t1.name = 'Germany 1. Bundesliga' AND SUBSTR(t2.`date`, 1, 7) BETWEEN '2008-08' AND '2008-10'


Question: What is the average overall rating of the football player Aaron Doran?

average overall rating = AVG(overall_rating);

SELECT CAST(SUM(t2.overall_rating) AS REAL) / COUNT(t2.id) FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_api_id = t2.player_api_id WHERE t1.player_name = 'Aaron Doran'


Question: What is the bond type of TR007_4_19?

double bond refers to bond_type = ' = '; single bond refers to bond_type = '-'; triple bond refers to bond_type = '#';

SELECT T.bond_type FROM bond AS T WHERE T.bond_id = 'TR007_4_19'


Question: Among the players with an overall rating between 60 to 65, how many players whose going to be in all of your attack moves instead of defensing?

overall_rating > = 60 AND overall_rating < 65; players whose going to be in all of your attack moves instead of defensing refers to defensive_work_rate = 'low';

SELECT COUNT(id) FROM Player_Attributes WHERE overall_rating BETWEEN 60 AND 65 AND defensive_work_rate = 'low'


Question: What college offers the major that Tyler Hewitt took?

SELECT T2.college FROM member AS T1 INNER JOIN major AS T2 ON T1.link_to_major = T2.major_id WHERE T1.first_name = 'Tyler' AND T1.last_name = 'Hewitt'


Question: For the first client who opened his/her account in Prague, what is his/her account ID?

SELECT T1.account_id FROM account AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T2.A3 = 'Prague' ORDER BY T1.date ASC LIMIT 1


Question: Provide the IDs and age of the client with high level credit card, which is eligible for loans.

the credit card is high-level refers to card.type = 'gold'; eligible for loans refers to disp.type = 'OWNER'

SELECT T1.client_id, STRFTIME('%Y', CURRENT_TIMESTAMP) - STRFTIME('%Y', T3.birth_date) FROM disp AS T1 INNER JOIN card AS T2 ON T2.disp_id = T1.disp_id INNER JOIN client AS T3 ON T1.client_id = T3.client_id WHERE T2.type = 'gold' AND T1.type = 'OWNER'


Question: Calculate the total cost spent for Parking in the list.

total cost spent for Parking refers to SUM(cost) where expense_description = 'Parking'

SELECT SUM(cost) FROM expense WHERE expense_description = 'Parking'


Question: Please list the positions of the circuits built by the constructor Renault.

SELECT DISTINCT T1.position FROM constructorStandings AS T1 INNER JOIN constructors AS T2 ON T2.constructorId = T1.constructorId WHERE T2.name = 'Renault'


Question: How long did it take the user, known by his or her display name 'Zolomon' to get the badge? Count from the date the user's account was created.

SUBTRACT(Date from stats_badges, CreationDate) where DisplayName = 'Zolomon';

SELECT T1.Date - T2.CreationDate FROM badges AS T1 INNER JOIN users AS T2 ON T1.UserId = T2.Id WHERE T2.DisplayName = 'Zolomon'


Question: In which country was the first European Grand Prix hosted? Name the circuit and location.

SELECT T1.country, T1.location FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T2.name = 'European Grand Prix' ORDER BY T2.year ASC LIMIT 1


Question: Which country is the oldest driver from?

date of birth refers to drivers.dob; The larger the birthday value, the younger the person is, and vice versa;

SELECT nationality FROM drivers WHERE dob IS NOT NULL ORDER BY dob ASC LIMIT 1


Question: Provide the account ID, district and region for loan amount greater than USD300,000.

A2 contains district names and A3 contains region names.

SELECT T1.account_id, T2.A2, 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.amount > 300000


Question: How many unknown power cards contain info about the triggered ability

unknown power cards refers to power is null or power = '*';contain info about the triggered ability refers to text contains 'triggered ability'

SELECT T2.text FROM cards AS T1 INNER JOIN rulings AS T2 ON T1.uuid = T2.uuid WHERE (T1.power IS NULL OR T1.power = '*') AND T2.text LIKE '%triggered ability%'


Question: Name 10 users with the badge name 'Necromancer.'

"Necromancer" is the Name of badge; users refers to DisplayName

SELECT T1.DisplayName FROM users AS T1 INNER JOIN badges AS T2 ON T1.Id = T2.UserId WHERE T2.Name = 'Necromancer' LIMIT 10


Question: 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('negative', '0');

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


Question: What kind of expenses incurred by members who have X-Large in size of tee shirt?

kind of expenses refers to expense_description; t_shirt_size = 'X-Large'

SELECT T2.expense_description FROM member AS T1 INNER JOIN expense AS T2 ON T1.member_id = T2.link_to_member WHERE T1.t_shirt_size = 'X-Large'


Question: Where can I find the information about the races held on Sepang International Circuit?

SELECT DISTINCT T1.url FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T1.name = 'Sepang International Circuit'


Question: What are the card layout of cards with keyword of flying?

SELECT layout FROM cards WHERE keywords = 'Flying'


Question: Was the patient with the number 57266's uric acid within a normal range?

uric acid within a normal range refers to UA > 8.0 and SEX = 'M'OR UA > 6.5 and SEX = 'F'

SELECT CASE WHEN (T1.SEX = 'F' AND T2.UA > 6.5) OR (T1.SEX = 'M' AND T2.UA > 8.0) THEN true ELSE false END FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T1.ID = 57266


Question: Which client segment consumed the least in September 2013?

September 2013 refers to yearmonth.date = '201309'

SELECT T1.Segment FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.Date = '201309' GROUP BY T1.CustomerID ORDER BY SUM(T2.Consumption) ASC LIMIT 1


Question: How many atoms belong to molecule id TR001?

SELECT COUNT(T.atom_id) FROM atom AS T WHERE T.molecule_id = 'TR001'


Question: Provide the ID, sex, birthday of all patients diagnosed with 'RA' that are within the UN normal index.

within the UN normal index refers to UN < 30; Diagnosis = 'RA'

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 < 30 AND T1.Diagnosis = 'RA'


Question: In comments with score between 1 to 5, list down the display names of the users with 0 down votes.

SELECT T2.DisplayName FROM comments AS T1 INNER JOIN users AS T2 ON T1.UserId = T2.Id WHERE T1.Score BETWEEN 1 AND 5 AND T2.DownVotes = 0


Question:
What is the difference of the average ball control score between Abdou Diallo and Aaron Appindangoye
?

difference of the average ball control = SUBTRACT(AVG(ball_control WHERE player_name = 'Abdou Diallo'), AVG(ball_control WHERE player_name = 'Aaron Appindangoye')); AVG(ball_control WHERE player_name = 'XX XX') = SUM(CASE WHEN player_name = 'XX XX' THEN ball_control ELSE 0 END) / COUNT(CASE WHEN player_name = 'XX XX' THEN id ELSE NULL END)

SELECT CAST(SUM(CASE WHEN t1.player_name = 'Abdou Diallo' THEN t2.ball_control ELSE 0 END) AS REAL) / COUNT(CASE WHEN t1.player_name = 'Abdou Diallo' THEN t2.id ELSE NULL END) - CAST(SUM(CASE WHEN t1.player_name = 'Aaron Appindangoye' THEN t2.ball_control ELSE 0 END) AS REAL) / COUNT(CASE WHEN t1.player_name = 'Aaron Appindangoye' THEN t2.id ELSE NULL END) FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_api_id = t2.player_api_id


Question: Among the superheroes with the race of god/eternal, how many of them are male

race "god/eternal" refers to race_id = 21; male refers to gender.id = 1

SELECT COUNT(*) FROM superhero AS T1 INNER JOIN race AS T2 ON T1.race_id = T2.id INNER JOIN gender AS T3 ON T3.id = T1.gender_id WHERE T1.race_id = 21 AND T1.gender_id = 1


Question: How many artists have designed a card with a black border color and is available in both "arena" and "mtgo" printing type?

available in both "arena" and "mtgo" refers to availability like '%arena,mtgo%'

SELECT COUNT(CASE WHEN availability LIKE '%arena,mtgo%' AND borderColor = 'black' THEN 1 ELSE NULL END) FROM cards


Question: Which driver was in the no. 4 grid formation when starting the race in 1989's Australian Grand Prix? Please give his forename and surname.

the no. 4 grid formation refers to grid = 4

SELECT T3.forename, T3.surname 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 T2.grid = 4 AND T1.name = 'Australian Grand Prix' AND T1.year = 1989


Question: What is the unabbreviated mailing street address of the school with the highest FRPM count for K-12 students?

SELECT T2.MailStreet FROM frpm AS T1 INNER JOIN schools AS T2 ON T1.CDSCode = T2.CDSCode ORDER BY T1.`FRPM Count (K-12)` DESC LIMIT 1


Question: What is the age gap between the youngest and oldest patient with a normal triglyceride recorded?

age gap refers to SUBTRACT(MAX(year(Birthday)) - MIN(year(Birthday))); normal triglyceride refers to tg > = 200

SELECT STRFTIME('%Y', MAX(T1.Birthday)) - STRFTIME('%Y', MIN(T1.Birthday)) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.TG >= 200


Question: Which country is the Belgium Jupiler League from?

Belgium Jupiler League refers to League.name = 'Belgium Jupiler League';

SELECT t1.name FROM Country AS t1 INNER JOIN League AS t2 ON t1.id = t2.country_id WHERE t2.name = 'Belgium Jupiler League'


Question: Among the cards that doesn't have multiple faces on the same card, who is the illustrator of the card art that has the highest cost of converted mana?

doesn't have multiple faces refers to side IS NULL; illustrator refers to artist

SELECT artist FROM cards WHERE side IS NULL ORDER BY convertedManaCost DESC LIMIT 1


Question: What is the Italian flavor text of the card "Ancestor's Chosen"?

Italian refers to language = 'Italian'; flavor text refers to flavorText; "Ancestor''s Chosen" refers to name = 'Ancestor''s Chosen'

SELECT T2.flavorText FROM cards AS T1 INNER JOIN foreign_data AS T2 ON T2.uuid = T1.uuid WHERE T1.name = 'Ancestor''s Chosen' AND T2.language = 'Italian'


Question: How many negative comments did Neil McGuigan get in his posts?

Negative comment refers to score < 60; DisplayName = 'Neil McGuigan';

SELECT COUNT(T3.Id) FROM users AS T1 INNER JOIN posts AS T2 ON T1.Id = T2.OwnerUserId INNER JOIN comments AS T3 ON T2.Id = T3.PostId WHERE T1.DisplayName = 'Neil McGuigan' AND T3.Score < 60


Question: 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 = '#'


Question: What was the fastest lap speed among all drivers in the 2009 Spanish Grand Prix?

the fastest lap speed among all refers to max(fastestLapSpeed); Spanish Grand Prix refers to races.name = 'Spanish Grand Prix';

SELECT T2.fastestLapSpeed FROM races AS T1 INNER JOIN results AS T2 ON T2.raceId = T1.raceId WHERE T1.name = 'Spanish Grand Prix' AND T1.year = 2009 AND T2.fastestLapSpeed IS NOT NULL ORDER BY T2.fastestLapSpeed DESC LIMIT 1


Question: Which user made a post titled 'Understanding what Dassault iSight is doing?' and how much is the reputation of the user?

"Understanding what Dassault iSight is doing?" is the Title of post; user refers to DisplayName;

SELECT T1.DisplayName, T1.Reputation FROM users AS T1 INNER JOIN posts AS T2 ON T1.Id = T2.OwnerUserId WHERE T2.Title = 'Understanding what Dassault iSight is doing?'


Question: Please list the Italian text ruling of all the cards in the set Coldsnap.

card set Coldsnap refers to name = 'Coldsnap'; Italian refers to language = 'Italian'

SELECT DISTINCT T1.text FROM foreign_data AS T1 INNER JOIN cards AS T2 ON T2.uuid = T1.uuid INNER JOIN sets AS T3 ON T3.code = T2.setCode WHERE T3.name = 'Coldsnap' AND T1.language = 'Italian'


Question: 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'


Question: For the driver who had the Q2 time as 0:01:40 in the qualifying race No. 355, what is his nationality?

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%'


Question: 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 FROM schools AS T2 LEFT JOIN satscores AS T1 ON T2.CDSCode = T1.cds WHERE strftime('%Y', T2.OpenDate) > '1991' OR strftime('%Y', T2.ClosedDate) < '2000'


Question: How many users whose reputations are higher than 2000 and the number of views is higher than 1000?

reputations are higher than 2000 refer to Reputation > 2000; number of views is higher than 1000 refers to Views > 1000;

SELECT COUNT(id) FROM users WHERE Reputation > 2000 AND Views > 1000


Question: List down most tallest players' name.

tallest refers to rank based on the height in descending order; Most tallest players refers to rank = 1

SELECT player_name FROM (SELECT player_name, height, DENSE_RANK() OVER (ORDER BY height DESC) as rank FROM Player) WHERE rank = 1


Question: Is molecule TR151 carcinogenic?

label = '+' mean molecules are carcinogenic;

SELECT T.label FROM molecule AS T WHERE T.molecule_id = 'TR151'


Question: 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


Question: 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 T1.baseSetSize DESC LIMIT 1


Question: Name the driver with the most winning. Mention his nationality and what is his maximum point scores.

Full name of the driver refers to drivers.forename and drivers.surname; the most winning refers to MAX(COUNT(wins)); average point scores refers to MAX(points);

SELECT T1.forename, T1.surname, T1.nationality, MAX(T2.points) FROM drivers AS T1 INNER JOIN driverStandings AS T2 ON T2.driverId = T1.driverId WHERE T2.wins >= 1 GROUP BY T1.forename, T1.surname, T1.nationality ORDER BY COUNT(T2.wins) DESC LIMIT 1


Question: What is the element with the atom ID of TR004_7 in molecule that is not carcinogenic?

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 T1.element FROM atom AS T1 INNER JOIN molecule AS T2 ON T1.molecule_id = T2.molecule_id WHERE T1.atom_id = 'TR004_7' AND T2.label = '-'


Question: What is the total number of superheroes that have John as their first name?

have John as their first name refers to full_name LIKE 'John%';

SELECT COUNT(id) FROM superhero WHERE full_name LIKE 'John%'


Question: Where is the hometown of Garrett Gerke?

SELECT T2.city FROM member AS T1 INNER JOIN zip_code AS T2 ON T2.zip_code = T1.zip WHERE T1.first_name = 'Garrett' AND T1.last_name = 'Gerke'


Question: What is his number of the driver who finished 0:01:54 in the Q3 of qualifying race No.903?

race number refers to raceId; finished 0:0M:SS in the Q3 refers to q3 LIKE 'M:SS%'

SELECT T2.number FROM qualifying AS T1 INNER JOIN drivers AS T2 ON T2.driverId = T1.driverId WHERE T1.raceId = 903 AND T1.q3 LIKE '1:54%'


Question: What is the region of the client with the id 3541 from?

SELECT T1.A3 FROM district AS T1 INNER JOIN client AS T2 ON T1.district_id = T2.district_id WHERE T2.client_id = 3541


Question: What is Abomination's eye colour?

Abomination refers to superhero_name = 'Abomination'; eye colour refers to colour.colour where eye_colour_id = colour.id;

SELECT T2.colour FROM superhero AS T1 INNER JOIN colour AS T2 ON T1.eye_colour_id = T2.id WHERE T1.superhero_name = 'Abomination'


Question: Which carcinogenic molecule have the highest number of atoms consisted in it?

label = '+' mean molecules are carcinogenic; molecule that have the highest number of atoms consisted in in refers to MAX(COUNT(atom.molecule_id))

SELECT T.molecule_id FROM ( SELECT T2.molecule_id, COUNT(T1.atom_id) FROM atom AS T1 INNER JOIN molecule AS T2 ON T1.molecule_id = T2.molecule_id WHERE T2.label = '+' GROUP BY T2.molecule_id ORDER BY COUNT(T1.atom_id) DESC LIMIT 1 ) t


Question: List the atom ID of the carcinogenic molecule that contains oxygen?

label = '+' mean molecules are carcinogenic; oxygen refers to element = 'o'

SELECT T1.atom_id FROM atom AS T1 INNER JOIN molecule AS T2 ON T1.molecule_id = T2.molecule_id WHERE T1.element = 'o' AND T2.label = '+'


Question: What are the elements for bond id TR001_10_11?

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'


Question: Among the sets of cards that have an Italian translation, how many of them have a base set number of under 100?

Italian translation refers to language = 'Italian'; have a translation means translation is not null; base set number of under 100 refers to baseSetSize < 10

SELECT COUNT(T1.id) FROM sets AS T1 INNER JOIN set_translations AS T2 ON T2.setCode = T1.code WHERE T2.translation IS NOT NULL AND T1.baseSetSize < 100 AND T2.language = 'Italian'


Question: How many loan accounts are for pre-payment of duration of 24 months with weekly issuance of statement.

Frequency = 'POPLATEK TYDNE' referes to weekly statement

SELECT COUNT(T2.account_id) FROM account AS T1 INNER JOIN loan AS T2 ON T1.account_id = T2.account_id WHERE T2.duration = 24 AND T1.frequency = 'POPLATEK TYDNE'


Question: Write down the ruling of Beacon of Immortality.

Beacon of Immortality' is the name of card;

SELECT T2.text FROM cards AS T1 INNER JOIN rulings AS T2 ON T1.uuid = T2.uuid WHERE T1.name = 'Beacon of Immortality'


Question: What is the average number of badges obtained by a user with over 200 views?

user with over 200 views refers to Views > 200; average number of badges = Divide (Count(Id), Count(DisplayName))

SELECT CAST(COUNT(T1.Id) AS REAL) / COUNT(DISTINCT T2.DisplayName) FROM badges AS T1 INNER JOIN users AS T2 ON T1.UserId = T2.Id WHERE T2.Views > 200


Question: Which country's gas station had the first paid cusomer in 2012/8/25?

SELECT T2.Country FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID WHERE T1.Date = '2012-08-25' ORDER BY T1.Time DESC LIMIT 1


Question: How many male patients have their glutamic oxaloacetic transaminase in the normal range?

male refers to Sex = 'M'; glutamic oxaloacetic transaminase in the normal range refers to GOT < 60;

SELECT COUNT(T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.GOT < 60 AND T1.SEX = 'M'


Question: Which players had an overall rating of over 80 from 2008 to 2010? Please list player names.

overall_rating > 80; from 2008 to 2010 refers to strftime('%Y', date) BETWEEN '2008' AND '2010';

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.overall_rating > 80 AND SUBSTR(t2.`date`, 1, 4) BETWEEN '2008' AND '2010'


Question: What percentage of patients who were born in 1980 and were diagnosed with RA are women?

born in 1980 refers to YEAR(BIRTHDAY) = '1980'; 'RA' refers to Diagnosis='RA' ; women refers to SEX = 'F'; calculation = DIVIDE(SUM(SEX = 'F'), COUNT(SEX)) * 100

SELECT CAST(SUM(CASE WHEN SEX = 'F' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(ID) FROM Patient WHERE Diagnosis = 'RA' AND STRFTIME('%Y', Birthday) = '1980'


Question: State the name of the most strongest player.

strongest players refers to player has 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 WHERE t2.overall_rating = (SELECT MAX(overall_rating) FROM Player_Attributes)


Question: 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'


Question: What is the language and flavor text of the card that has colorpie watermark? List out the type of this card.

SELECT DISTINCT T2.language, T2.flavorText FROM cards AS T1 INNER JOIN foreign_data AS T2 ON T2.uuid = T1.uuid WHERE T1.watermark = 'colorpie'


Question: Please provide the ids of top three powerful pairs of Kingdom Foil and Kingdom Cards sorted by Kingdom Foil id in alphabetical order.

poweful refers to cardKingdomFoilId is not null AND cardKingdomId is not null

SELECT cardKingdomFoilId, cardKingdomId FROM cards WHERE cardKingdomFoilId IS NOT NULL AND cardKingdomId IS NOT NULL ORDER BY cardKingdomFoilId LIMIT 3


Question: How many student have the position of president?

'President' is a position of Student Club

SELECT COUNT(member_id) FROM member WHERE position = 'President'


Question: List the comments commented by the user with a username of Harvey Motulsky.

comments refer to Text; username of Harvey Motulsky refers to DisplayName = 'Harvey Motulsky';

SELECT T1.Text FROM comments AS T1 INNER JOIN users AS T2 ON T1.UserId = T2.Id WHERE T2.DisplayName = 'Harvey Motulsky'


Question: Please list the countries of the gas stations with transactions taken place in June, 2013.

June 2013 refers to '201306'; The first 4 strings of the Date values in the yearmonth table can represent year; The 5th and 6th string of the date can refer to month;

SELECT DISTINCT T2.Country FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID INNER JOIN yearmonth AS T3 ON T1.CustomerID = T3.CustomerID WHERE T3.Date = '201306'


Question: Give the name of the league with the highest matches of all time and how many matches were played in the said league.

league with highest matches of all time refers to MAX(COUNT(league_id));

SELECT t2.name, t1.max_count FROM League AS t2 JOIN (SELECT league_id, MAX(cnt) AS max_count FROM (SELECT league_id, COUNT(id) AS cnt FROM Match GROUP BY league_id) AS subquery) AS t1 ON t1.league_id = t2.id


Question: For all the budgets for "November Meeting", how many of them had exceeded the budget?

'November Meeting' is an event name; remaining < 0 means the cost had exceeded the budget

SELECT COUNT(T2.event_id) FROM budget AS T1 INNER JOIN event AS T2 ON T1.link_to_event = T2.event_id WHERE T2.event_name = 'November Meeting' AND T1.remaining < 0


Question: How many chartered schools located in the city of Hickman are owned by the Elementary School District?

Elementary School District refers to DOC = 52; Chartered schools refer to Charter = 1 in the table schools

SELECT COUNT(School) FROM schools WHERE DOC = 52 AND Charter = 1 AND City = 'Hickman'


Question: List the expansion type of the set "Huitième édition".

the set "Huitième édition" refers to translation = 'Huitième édition'; expansion type refers to type

SELECT type FROM sets WHERE code IN ( SELECT setCode FROM set_translations WHERE translation = 'Huitième édition' )


Question: Which of these players performs the best in crossing actions, Alexis, Ariel Borysiuk or Arouna Kone?

player who perform best in crossing actions refers to MAX(crossing);

SELECT t1.player_name, t2.crossing FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_api_id = t2.player_api_id WHERE t1.player_name IN ('Alexis', 'Ariel Borysiuk', 'Arouna Kone') ORDER BY t2.crossing DESC LIMIT 1


Question: 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),T2.forename, T2.surname FROM driverStandings AS T1 INNER JOIN drivers AS T2 on T1.driverId = T2.driverId ORDER BY T2.dob ASC LIMIT 1


Question: Which year has the lowest speed of lap time?

lowest speed of lap time refers to Max(time);

SELECT T2.year FROM lapTimes AS T1 INNER JOIN races AS T2 on T1.raceId = T2.raceId ORDER BY T1.time DESC LIMIT 1


Question: Give the only one comment text of the post with parent id 107829.

one comment refers to CommentCount = '1'

SELECT T2.Text FROM posts AS T1 INNER JOIN comments AS T2 ON T1.Id = T2.PostId WHERE T1.ParentId = 107829 AND T1.CommentCount = 1


Question: What are the race and alignment of Cameron Hicks?

Cameron Hicks refers to superhero_name = 'Cameron Hicks';

SELECT T2.race, T3.alignment FROM superhero AS T1 INNER JOIN race AS T2 ON T1.race_id = T2.id INNER JOIN alignment AS T3 ON T1.alignment_id = T3.id WHERE T1.superhero_name = 'Cameron Hicks'


Question: List all the short name of the football team that had a home team goal of 10?

short name of the football team refers to team_short_name; home team goal refers to home_team_goal; home_team_goal = 10;

SELECT t1.team_short_name FROM Team AS t1 INNER JOIN Match AS t2 ON t1.team_api_id = t2.home_team_api_id WHERE t2.home_team_goal = 10


Question: How many users were adult?

adult refers to user where Age BETWEEN 19 and 65;

SELECT COUNT(id) FROM users WHERE Age BETWEEN 19 AND 65


Question: State the district and region for loan ID '4990'.

A2, A3 contains the information about district and region respectively.

SELECT T2.A2, 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.loan_id = 4990


Question: List out the name of badges that users obtained on 7/19/2010 7:39:08 PM.

SELECT Name FROM badges WHERE Date = '2010-07-19 19:39:08.0'


Question: Lists by ID all Creature-type cards with legal status.

legal status refer to status = 'legal'; Goblin-type cards refer to types = 'Creature';

SELECT T1.id FROM cards AS T1 INNER JOIN rulings AS T2 ON T1.uuid = T2.uuid INNER JOIN legalities AS T3 ON T1.uuid = T3.uuid WHERE T3.status = 'Legal' AND T1.types = 'Creature'


Question: Who are the players that tend to be attacking when their mates were doing attack moves? List down their name.

tend to be attacking when their mates were doing attack moves refers to attacking_work_rate = 'high';

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.attacking_work_rate = 'high'


Question: What's the magic card market name for the set which was released on 2017/6/9?

magic card market name refers to mcmName

SELECT mcmName FROM sets WHERE releaseDate = '2017-06-09'


Question: What are the cards in set 10E with converted mana of 5 have translation and what are the languages?

set 10E refers to setCode = '10E'; converted mana of 5 refers to convertedManaCost = 5;

SELECT id, language FROM set_translations WHERE id = ( SELECT id FROM cards WHERE convertedManaCost = 5 ) AND setCode = '10E'


Question: What are the post history type IDs for post ID 3720 and how many unique users have commented on the post?

SELECT T1.PostHistoryTypeId, (SELECT COUNT(DISTINCT UserId) FROM comments WHERE PostId = 3720) AS NumberOfUsers FROM postHistory AS T1 WHERE T1.PostId = 3720


Question: List out the set name of the set code "ALL".

SELECT name FROM sets WHERE code = 'ALL'


Question: Identify the heaviest superhero in DC Comics.

heaviest refers to MAX(weight_kg); DC Comics refers to publisher_name = 'DC Comics'; superhero refers to superhero_name;

SELECT T1.superhero_name FROM superhero AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.id WHERE T2.publisher_name = 'DC Comics' ORDER BY T1.weight_kg DESC LIMIT 1


Question: State the chance creation passing class for "PEC Zwolle" on 2013/9/20.

"PEC Zwolle" refers to team_long_name = 'PEC Zwolle'; on 2013/9/20 refers to date = '2013-09-20 00:00:00'

SELECT t2.chanceCreationPassingClass FROM Team AS t1 INNER JOIN Team_Attributes AS t2 ON t1.team_api_id = t2.team_api_id WHERE t1.team_long_name = 'PEC Zwolle' AND SUBSTR(t2.`date`, 1, 10) = '2013-09-20'


Question: How many cards are there in the base set of "Hauptset Zehnte Edition"?

"Hauptset Zehnte Edition" refers to translation = 'Hauptset Zehnte Edition'; number of cards refers to baseSetSize

SELECT T1.baseSetSize FROM sets AS T1 INNER JOIN set_translations AS T2 ON T2.setCode = T1.code WHERE T2.translation = 'Hauptset Zehnte Edition'


Question: For all the drivers who finished the game in race No. 872, who is the youngest?

race number refers to raceId; drivers who finished the race refers to time has value; the youngest is a driver where MAX(dob);

SELECT T1.forename, T1.surname FROM drivers AS T1 INNER JOIN results AS T2 ON T2.driverId = T1.driverId WHERE T2.raceId = 872 AND T2.time IS NOT NULL ORDER BY T1.dob DESC LIMIT 1


Question: 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


Question: Find the name and date of events with expenses for pizza that were more than fifty dollars but less than a hundred dollars.

name of event refers to event_name; date of event refers to event_date; expenses for pizza refers to expense_description = 'Pizza' where cost > 50 and cost < 100

SELECT T1.event_name, T1.event_date FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event INNER JOIN expense AS T3 ON T2.budget_id = T3.link_to_budget WHERE T3.expense_description = 'Pizza' AND T3.cost > 50 AND T3.cost < 100


Question: Please list the diagnosis of the patients whose total protein is lower than normal.

total protein is lower than normal refers to TP < 6.0;

SELECT T1.Diagnosis FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.TP < 6.0


Question: List the superheroes from Marvel Comics who have the super power of 'Super Strength'.

the superheroes from Marvel Comics refers to publisher_name = 'Marvel Comics'; super power of "Super Strength" refers to power_name = 'Super Strength';

SELECT superhero_name FROM superhero AS T1 WHERE EXISTS (SELECT 1 FROM hero_power AS T2 INNER JOIN superpower AS T3 ON T2.power_id = T3.id WHERE T3.power_name = 'Super Strength' AND T1.id = T2.hero_id)AND EXISTS (SELECT 1 FROM publisher AS T4 WHERE T4.publisher_name = 'Marvel Comics' AND T1.publisher_id = T4.id)


Question: How many students of the Student_Club have attended the event "Women's Soccer"?

SELECT COUNT(T1.event_id) FROM event AS T1 INNER JOIN attendance AS T2 ON T1.event_id = T2.link_to_event WHERE T1.event_name = 'Women''s Soccer'


Question: Among the schools with an SAT excellence rate of over 0.3, what is the highest eligible free rate for students aged 5-17?

Excellence rate = NumGE1500 / NumTstTakr; Eligible free rates for students aged 5-17 = `Free Meal Count (Ages 5-17)` / `Enrollment (Ages 5-17)`

SELECT MAX(CAST(T1.`Free Meal Count (Ages 5-17)` AS REAL) / T1.`Enrollment (Ages 5-17)`) FROM frpm AS T1 INNER JOIN satscores AS T2 ON T1.CDSCode = T2.cds WHERE CAST(T2.NumGE1500 AS REAL) / T2.NumTstTakr > 0.3


Question: How many card border with black color ? List out the card id.

border with black color refers to borderColor = 'black'

SELECT id FROM cards WHERE borderColor = 'black' GROUP BY id


Question: 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


Question: 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')


Question: What percentage of legendary frame effect cards that are only available in online game variations?

only available in online game variationsrefer to isOnlineOnly =1 ; legendary frame effect cards refer to frameEffects = 'legendary'; percentage refer to DIVIDE(COUNT(isOnlineOnly=1), COUNT(id)) from cards where frameEffects = 'legendary'

SELECT SUM(CASE WHEN isOnlineOnly = 1 THEN 1.0 ELSE 0 END) / COUNT(id) * 100 FROM cards WHERE frameEffects = 'legendary'


Question: What's the code for the set which was released on 2017/7/14?

released on 2017/7/14 refers to releaseDate = '2017-07-14'

SELECT code FROM sets WHERE releaseDate = '2017-07-14' GROUP BY releaseDate, code


Question: 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


Question: What is the long passing score of the oldest player?

long passing score refers to long_passing; oldest player refers to oldest birthday;

SELECT t2.long_passing FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_api_id = t2.player_api_id ORDER BY t1.birthday ASC LIMIT 1


Question: On average, how much did the Student_Club spend on food for the typical event in the past?

DIVIDE(SUM(spent), COUNT(spent)) where category = 'Food'; 'event in the past' means event_status = 'Closed'

SELECT SUM(spent) / COUNT(spent) FROM budget WHERE category = 'Food' AND event_status = 'Closed'


Question: Provide the hero name and race of Charles Chandler.

hero name refers to superhero_name; Charles Chandler is the full name of superhero;

SELECT T1.superhero_name, T2.race FROM superhero AS T1 INNER JOIN race AS T2 ON T1.race_id = T2.id WHERE T1.full_name = 'Charles Chandler'


Question: Show me the season page of year when the race No. 901 took place.

SELECT T2.url FROM races AS T1 INNER JOIN seasons AS T2 ON T2.year = T1.year WHERE T1.raceId = 901


Question: Who are the female account holders who own credit cards and also have loans?

SELECT T1.client_id FROM client AS T1 INNER JOIN disp AS T2 ON T1.client_id = T2.client_id INNER JOIN account AS T5 ON T2.account_id = T5.account_id INNER JOIN loan AS T3 ON T5.account_id = T3.account_id INNER JOIN card AS T4 ON T2.disp_id = T4.disp_id WHERE T1.gender = 'F'


Question: Write the full name of the member who spent money for water, veggie tray and supplies and include the cost of it.

full name refers to first_name, last name; spent money for refers expense description; expense_description = 'Water, Veggie tray, supplies'

SELECT T2.first_name, T2.last_name, T1.cost FROM expense AS T1 INNER JOIN member AS T2 ON T1.link_to_member = T2.member_id WHERE T1.expense_description = 'Water, Veggie tray, supplies'


Question: List out the atom id that belongs to the TR346 molecule and how many bond type can be created by this molecule?

SELECT T1.atom_id, COUNT(DISTINCT T2.bond_type),T1.molecule_id FROM atom AS T1 INNER JOIN bond AS T2 ON T1.molecule_id = T2.molecule_id WHERE T1.molecule_id = 'TR000' GROUP BY T1.atom_id, T2.bond_type


Question: Which drivers born after 1975 have been ranked 2? Please give their forenames and surnames.

born after 1975 refers to year(dob) >1975;

SELECT T2.forename, T2.surname FROM results AS T1 INNER JOIN drivers AS T2 on T1.driverId = T2.driverId WHERE STRFTIME('%Y', T2.dob) > '1975' AND T1.rank = 2


Question: How many Formula_1 races took place on the circuits in Italy?

SELECT COUNT(T2.circuitId) FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T1.country = 'Italy'


Question: To which artist does the card with the text "Das perfekte Gegenmittel zu einer dichten Formation" belong?

SELECT DISTINCT T1.artist FROM cards AS T1 INNER JOIN foreign_data AS T2 ON T1.uuid = T2.uuid WHERE T2.flavorText LIKE '%DAS perfekte Gegenmittel zu einer dichten Formation%'


Question: List out the full name and total cost that member id "rec4BLdZHS2Blfp4v" incurred?

full name refers to first_name, last name

SELECT T1.first_name, T1.last_name, SUM(T2.cost) FROM member AS T1 INNER JOIN expense AS T2 ON T1.member_id = T2.link_to_member WHERE T1.member_id = 'rec4BLdZHS2Blfp4v'


Question: 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 )


Question: What are the available printing types of the cards that doesn't have a text box created by Aleksi Briclot?

created by Aleksi Briclot refers to artist = 'Aleksi Briclot'; doesn't have a text box refers to isTextless = 1; available printing types refers to availability

SELECT DISTINCT availability FROM cards WHERE artist = 'Aleksi Briclot' AND isTextless = 1


Question: How many cards are there with toughness of 99?

SELECT COUNT(id) FROM cards WHERE toughness = 99


Question: List the players' api id who had the highest above average overall ratings in 2010.

highest above average overall ratings refers to MAX(overall_rating); in 2010 refers to substr(date,1,4) = '2010';

SELECT player_api_id FROM Player_Attributes WHERE SUBSTR(`date`, 1, 4) = '2010' ORDER BY overall_rating DESC LIMIT 1


Question: 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


Question: For all patients who are older than 55 years old, what is the percentage of female who has abnormal prothrombin time (PT)?

older than 55 years old = SUBTRACT(year(current_timestamp), year(Birthday)) > 55; abnormal prothrombin time (PT) refers to PT > = 14; percentage = DIVIDE(SUM(PT > = 14 AND SEX = 'F'), SUM(PT > = 14)) * 100; female refers to sex = 'F';

SELECT CAST(SUM(CASE WHEN T2.PT >= 14 AND T1.SEX = 'F' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE STRFTIME('%Y', CURRENT_TIMESTAMP) - STRFTIME('%Y', T1.Birthday) > 55


Question: Please list the time each driver spent at the pit stop during the 2011 Australian Grand Prix.

time spent at pit stop refers to duration

SELECT T1.duration FROM pitStops AS T1 INNER JOIN races AS T2 on T1.raceId = T2.raceId WHERE T2.year = 2011 AND T2.name = 'Australian Grand Prix'


Question: Where is Amy Firth's hometown?

SELECT T2.city, T2.county, T2.state FROM member AS T1 INNER JOIN zip_code AS T2 ON T1.zip = T2.zip_code WHERE T1.first_name = 'Amy' AND T1.last_name = 'Firth'


Question: 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


Question: What is the percentage of blue female superheroes among all female superheroes?

percentage = MULTIPLY(DIVIDE(SUM(colour = 'Blue' WHERE gender = 'Female'), COUNT(gender = 'Female')), 100); blue refers to the color = 'Blue' WHERE skin_colour_id = colour.id; female refers to gender = 'Female';

SELECT CAST(COUNT(CASE WHEN T3.colour = 'Blue' THEN T1.id ELSE NULL END) AS REAL) * 100 / COUNT(T1.id) FROM superhero AS T1 INNER JOIN gender AS T2 ON T1.gender_id = T2.id INNER JOIN colour AS T3 ON T1.skin_colour_id = T3.id WHERE T2.gender = 'Female'


Question: 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


Question: 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'


Question: 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


Question: For all the female patient age 50 and above, who has abnormal red blood cell count. State if they were admitted to hospital.

female patient refers to Sex = 'F'; age 50 and above = SUBTRACT(year(current_timestamp), year(Birthday)) > = 50; abnormal red blood cell count refers to RBC < = 3.5 or RBC > = 6.0; Admission = '+' means the patient was admitted to the hospital; Admission = '-' means the patient was not admitted to the hospital;

SELECT DISTINCT T1.ID, T1.Admission FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T1.SEX = 'F' AND (T2.RBC <= 3.5 OR T2.RBC >= 6.0) AND STRFTIME('%Y', CURRENT_TIMESTAMP) - STRFTIME('%Y', T1.Birthday) >= 50


Question: What is the language of the "Battlebond" set?

"Battlebond" set refers to name = 'Battlebond'

SELECT language FROM set_translations WHERE id IN ( SELECT id FROM sets WHERE name = 'Battlebond' )


Question: 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(date) = 2005

SELECT DISTINCT T2.name, T1.name, T1.location FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T2.year = 2005 AND STRFTIME('%m', T2.date) = '09'


Question: For the driver who had the Q2 time as 0:01:15 in race No. 347, where is he from?

SELECT DISTINCT T2.nationality FROM qualifying AS T1 INNER JOIN drivers AS T2 ON T2.driverId = T1.driverId WHERE T1.raceId = 347 AND T1.q2 LIKE '1:15%'


Question: List out the no. of districts that have female average salary is more than 6000 but less than 10000?

A11 refers to average salary; Female mapps to gender = 'F'

SELECT COUNT(DISTINCT T2.district_id)  FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T1.gender = 'F' AND T2.A11 BETWEEN 6000 AND 10000


Question: 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'


Question: What are the webpages for the Los Angeles County school that has between 2,000 and 3,000 test takers?

SELECT T2.Website FROM satscores AS T1 INNER JOIN schools AS T2 ON T1.cds = T2.CDSCode WHERE T1.NumTstTakr BETWEEN 2000 AND 3000 AND T2.County = 'Los Angeles'


Question: How many drivers from the UN participated in the 2008 Australian Grand Prix?

from the UN refers to nationality = 'British'

SELECT COUNT(*) FROM drivers AS T1 INNER JOIN results AS T2 ON T1.driverId = T2.driverId INNER JOIN races AS T3 ON T3.raceId = T2.raceId WHERE T3.name = 'Australian Grand Prix' AND T1.nationality = 'British' AND T3.year = 2008


Question: 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'


Question: 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'


Question: Which country is the constructor which got 1 point in the race No. 24 from?

SELECT T2.nationality FROM constructorResults AS T1 INNER JOIN constructors AS T2 ON T2.constructorId = T1.constructorId WHERE T1.raceId = 24 AND T1.points = 1


Question: How many cards with a 1993 frame version and available on paper have a sensitive content warning?

sensitive content warning refer to hasContentWarning = 1; available on paper refer to availability = 'paper' 1993 refer to frameVersion

SELECT COUNT(id) FROM cards WHERE frameVersion = 1993 AND availability = 'paper' AND hasContentWarning = 1


Question: Which superhero has the same eyes, hair and skin colour? Indicate the publisher of the superhero.

which superhero refers to superhero_name; the same eyes, hair and skin colour refers to hair_colour_id = skin_colour_id AND hair_colour_id = eye_colour_id; publisher refers to publisher_name;

SELECT T1.superhero_name, T2.publisher_name FROM superhero AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.id WHERE T1.eye_colour_id = T1.hair_colour_id AND T1.eye_colour_id = T1.skin_colour_id


Question: 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'


Question: Which accounts placed orders for household payment in Pisek?

k_symbol = 'SIPO' refers to household payment

SELECT DISTINCT T2.account_id FROM trans 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.k_symbol = 'SIPO' AND T3.A2 = 'Pisek'


Question: How many American drivers have puncture status.

puncture status refers to status = Puncture;

SELECT COUNT(T1.driverId) FROM drivers AS T1 INNER JOIN results AS T2 on T1.driverId = T2.driverId INNER JOIN status AS T3 on T2.statusId = T3.statusId WHERE T3.status = 'Puncture' AND T1.nationality = 'American'


Question: What's Lucas di Grassi's Q1 result in the race No. 345?

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'


Question: 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


Question: List the names of virtual schools that are among the top 5 in their respective counties based on average reading scores.

Exclusively virtual refers to Virtual = 'F'; respective counties means PARTITION BY County

SELECT School FROM (SELECT T2.School,T1.AvgScrRead, RANK() OVER (PARTITION BY T2.County ORDER BY T1.AvgScrRead DESC) AS rnk FROM satscores AS T1 INNER JOIN schools AS T2 ON T1.cds = T2.CDSCode WHERE T2.Virtual = 'F' ) ranked_schools WHERE rnk <= 5


Question: What is card number 4 in the set Coldsnap?

card set Coldsnap refers to name = 'Coldsnap'; card number 4 refers to number = 4

SELECT T1.name FROM cards AS T1 INNER JOIN sets AS T2 ON T2.code = T1.setCode WHERE T2.name = 'Coldsnap' AND T1.number = 4


Question: Calculate the percentage of players who prefer left foot, who were born between 1987 and 1992.

players who prefer left foot refers to preferred_foot = 'left'; percentage of players who prefer left foot = DIVIDE(MULTIPLY((SUM(preferred_foot = 'left'), 100)), COUNT(player_fifa_api_id)); born between 1987 and 1992 refers to YEAR(birthday) BETWEEN '1987' AND '1992';

SELECT CAST(COUNT(CASE WHEN t2.preferred_foot = 'left' 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 SUBSTR(t1.birthday, 1, 4) BETWEEN '1987' AND '1992'


Question: What is the  unconverted mana do all the cards created by Rob Alexander cost in total?

unconverted mana refer to manaCost; Rob Alexander refer to artist

SELECT manaCost FROM cards WHERE artist = 'Rob Alexander'


Question: Of all the carcinogenic molecules, which one has the most double bonds?

label = '+' mean molecules are carcinogenic; double bond refers to bond_type = ' = ';

SELECT T.molecule_id FROM ( SELECT T3.molecule_id, COUNT(T1.bond_type) FROM bond AS T1 INNER JOIN molecule AS T3 ON T1.molecule_id = T3.molecule_id WHERE T3.label = '+' AND T1.bond_type = '=' GROUP BY T3.molecule_id ORDER BY COUNT(T1.bond_type) DESC LIMIT 1 ) AS T


Question: Please list the full names of all the superheroes with over 15 super powers.

15 super powers refers to COUNT(full_name) > 15

SELECT DISTINCT T1.full_name FROM superhero AS T1 INNER JOIN hero_power AS T2 ON T1.id = T2.hero_id GROUP BY T1.full_name HAVING COUNT(T2.power_id) > 15


Question: 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 = '*'


Question: 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


Question: What is the display name of the user who acquired the highest amount of badges?

highest amount of badges refers to MAX(COUNT(Name));

SELECT T1.DisplayName FROM users AS T1 INNER JOIN badges AS T2 ON T1.Id = T2.UserId GROUP BY T1.DisplayName ORDER BY COUNT(T1.Id) DESC LIMIT 1


Question: How many posts have a score less than 20?

score less than 20 refers to Score < 20;

SELECT COUNT(id) FROM posts WHERE Score < 20


Question: What is the carcinogenic label for bond TR001_2_4?

label = '+' mean molecules are carcinogenic

SELECT DISTINCT T2.label 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_id = 'TR001_2_4'


Question: 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


Question: From race no. 50 to 100, how many finishers have been disqualified?

disqualified refers to statusID = 2, finisher refers to time! = null; race no. refers to raceId; raceId > 50 and raceId < 100;

SELECT SUM(IIF(time IS NOT NULL, 1, 0)) FROM results WHERE statusId = 2 AND raceID < 100 AND raceId > 50