target-benchmark/bird-queries-validation huggingface dataset:
Database: card_games
Question: Name the card and artist with the most ruling information. Also state if the card is a promotional printing.
Evidence: with the most ruling information refers to Max(count(rulings.uuid)); the card is the promotional printing refers to isPromo = 1;
SQL: SELECT T1.name, T1.artist, T1.isPromo FROM cards AS T1 INNER JOIN rulings AS T2 ON T1.uuid = T2.uuid WHERE T1.isPromo = 1 GROUP BY T1.artist ORDER BY COUNT(DISTINCT T1.uuid) DESC LIMIT 1
Database: card_games
Question: What is the border color of card "Ancestor's Chosen"?
Evidence: Ancestor's Chosen' is the name of card;
SQL: SELECT DISTINCT borderColor FROM cards WHERE name = 'Ancestor''s Chosen'
Database: card_games
Question: How many white bordered cards are powerful?
Evidence: white bordered cards refer to borderColor = 'white'; powerful cards refers to cardKingdomFoilId = cardKingdomId AND cardKingdomId is not null (replace)


SQL: SELECT COUNT(id) FROM cards WHERE borderColor = 'white' AND cardKingdomId IS NOT NULL AND cardKingdomFoilId IS NOT NULL
Database: card_games
Question: How many cards designed by UDON and available in mtgo print type has a starting maximum hand size of -1?
Evidence: UDON refer to artist; availabe in mtgo refers to availability = 'mtgo'; starting maximum hand size of -1 refers to hand = -1
SQL: SELECT COUNT(id) FROM cards WHERE hAND = '-1' AND artist = 'UDON' AND Availability = 'print' AND type = 'mtgo'
Database: card_games
Question: What is the mana cost of cards with a normal layout, a 2003 frame version, with a black border color, and available in paper and mtgo?
Evidence: available in paper refers to availability = 'paper'; available in mtgo refers to availability = 'mtgo; frameVersion = 2003;borderColor = 'black'

SQL: SELECT manaCost FROM cards WHERE availability = 'mtgo,paper' AND borderColor = 'black' AND frameVersion = 2003 AND layout = 'normal'
Database: card_games
Question: How much unconverted mana do all the cards created by Rob Alexander cost in total?
Evidence: unconverted mana refer to manaCost; Rob Alexander refer to artist
SQL: SELECT SUM(manaCost) FROM cards WHERE artist = 'Rob Alexander'
Database: card_games
Question: What percentage of legendary frame effect cards have a maximum starting maximun hand
size of +3?
Evidence: maximun hand size of +3 refer to hand = +3; legendary frame effect cards refer to frameEffects = 'legendary'; percentage refer to DIVIDE(COUNT(hand = '+3'), COUNT(id)) from cards where frameEffects = 'legendary'
SQL: SELECT SUM(CASE WHEN hAND = '+3' THEN 1.0 ELSE 0 END) / COUNT(id) * 100 FROM cards WHERE frameEffects = 'legendary'
Database: card_games
Question: What is the percentage of Story Spotlight cards that also have a text box? List them by their ID.
Evidence: Story Spotlight cards that do not have a text box refers to isStorylight = 1 and isTextless = 1; Percentage refer to DIVIDE(SUM(count(id) where isStorylight = 1), SUM(count(id))) * 100


SQL: SELECT CAST(SUM(CASE WHEN isTextless = 0 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(id) FROM cards WHERE isStorySpotlight = 1
Database: card_games
Question: How many Brazilian Portuguese translated sets are inside the Commander block?
Evidence: Commander block refer to block = 'Commander'; sets refer to setCode; Portuguese refer to language = 'Portuguese (Brasil)'


SQL: SELECT COUNT(T1.id) FROM sets AS T1 INNER JOIN set_translations AS T2 ON T1.code = T2.setCode WHERE T2.language = 'Portuguese (Brazil)' AND T1.block = 'Commander'
Database: card_games
Question: Lists all types of cards in German.
Evidence: German refer to language; all types refer to the union of subtypes and supertypes where subtypes is not null AND supertypes is not null
SQL: SELECT T1.subtypes, T1.supertypes FROM cards AS T1 INNER JOIN foreign_data AS T2 ON T1.uuid = T2.uuid WHERE T2.language = 'German' AND T1.subtypes IS NOT NULL AND T1.supertypes IS NOT NULL
Database: card_games
Question: How many null power cards contain info about the triggered ability
Evidence: null power cards refers to power is NULL; unknown power cards refers to power is null or power = '*'
SQL: 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 LIKE '%*%') AND T2.text LIKE '%triggered ability%'
Database: card_games
Question: Indicates the number of cards with pre-modern format, ruling text "This is a triggered mana ability" that do not have multiple faces.
Evidence: do not have multiple faces refers to side IS NULL
SQL: SELECT COUNT(T1.id) FROM cards AS T1 INNER JOIN legalities AS T2 ON T1.uuid = T2.uuid INNER JOIN rulings AS T3 ON T1.uuid = T3.uuid WHERE T2.format = 'premodern' AND T3.text = 'This is a triggered mana ability.' AND T1.Side IS NULL
Database: card_games
Question: How many cards with print rarity have ruling text printed on 10/01/2009?
Evidence: with print rarity refers to rarity = 'rare'; on 10/01/2009 refers to date = '2009-01-10'
SQL: SELECT COUNT(DISTINCT T1.id) FROM cards AS T1 INNER JOIN rulings AS T2 ON T1.uuid = T2.uuid WHERE T1.rarity = 'rare' AND T2.date = '2009-01-10'
Database: card_games
Question: What percentage of cards with format commander and legal status do not have a content warning?
Evidence: do not have a content warning refers to hasContentWarning = 0; 
percentage refers to DIVIDE(COUNT(hasContentWarning = 0),COUNT(ID))*100 where 
format = 'commander' AND Status = 'legal';

SQL: SELECT CAST(SUM(CASE WHEN T1.hasContentWarning = 0 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.id) FROM cards AS T1 INNER JOIN legalities AS T2 ON T1.uuid = T2.uuid WHERE T2.format = 'commander' AND T2.status = 'Legal'
Database: card_games
Question: What percentage of cards without power are in French?
Evidence: 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

SQL: SELECT CAST(SUM(CASE WHEN T2.language = 'French' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.id) FROM cards AS T1 INNER JOIN foreign_data AS T2 ON T1.uuid = T2.uuid WHERE T1.power IS NULL OR T1.power LIKE '%*%'
Database: card_games
Question: Which Russian set of cards contains the most cards overall?
Evidence: Russian refers to language = 'Russian'; contains the most cards overall refers to MAX(baseSetSize)
SQL: SELECT T1.id FROM sets AS T1 INNER JOIN set_translations AS T2 ON T1.code = T2.setCode WHERE T2.language = 'Russian' GROUP BY T1.baseSetSize ORDER BY COUNT(T1.id) DESC LIMIT 1
Database: card_games
Question: Of all the cards that are designed by Aaron Miller, how many of them are incredibly powerful?
Evidence: designed by Aaron Miller refers to artist = 'Aaron Miller'; are icredibily powerful refers to cardKingdomFoilId = cardKingdomId AND cardKingdomId is not null
SQL: SELECT SUM(CASE WHEN artist = 'Aaron Miller' AND cardKingdomFoilId IS NOT NULL AND cardKingdomId IS NOT NULL THEN 1 ELSE 0 END) FROM cards
Database: card_games
Question: How many cards available in paper have a positive starting maximum hand size?
Evidence: available in paper refers to availability like '%paper%'; have a positive starting maximum hand size refers to hand = '+%'
SQL: SELECT SUM(CASE WHEN availability = 'paper' AND hAND LIKE '+%' AND hAND != '+0' THEN 1 ELSE 0 END) FROM cards
Database: card_games
Question: How many artists have designed a card with a black border color and is available in both "arena" and "mtgo" printing type?
Evidence: available in both "arena" and "mtgo" refers to availability like '%arena,mtgo%'
SQL: SELECT COUNT(CASE WHEN availability LIKE '%arena,mtgo%' THEN 1 ELSE NULL END) FROM cards
Database: card_games
Question: Which card costs more converted mana, "Serra Angel" or "Shrine Keeper"?
Evidence: "Serra Angel" refers to name = 'Serra Angel'; "Shrine Keeper" refers to name = 'Shrine Keeper'; 
card costs more converted mana when the value of convertedManaCost is greater
SQL: SELECT name FROM cards WHERE name IN ('Serra Angel', 'Shrine Keeper') ORDER BY convertedManaCost DESC LIMIT 1
Database: card_games
Question: What's the Italian name of the set of cards with "Ancestor's Chosen" is in?
Evidence: Italian is a language which refers to language = 'Italian'; with "Ancestor's Chosen" in the card set refers to name = 'Ancestor's Chosen'
SQL: SELECT translation FROM set_translations WHERE setCode IN ( SELECT setCode FROM cards WHERE name = 'Ancestor''s Chosen' ) AND language = 'Italian'
Database: card_games
Question: For the set of cards with "Ancestor's Chosen" in it, is there a Korean version of it?
Evidence: set of cards with "Ancestor's Chosen" in it refers to name = 'Ancestor's Chosen'; Korean version refers to language = 'Korean'
SQL: 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'
Database: card_games
Question: What is the Simplified Chinese translation of the name of the set "Eighth Edition"?
Evidence: Eighth Edition is the name of card set which refers to name = 'Eighth Edition'; Simplified Chinese is the language; translation of the name refers to translation
SQL: 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'
Database: card_games
Question: Among the sets in the block "Ice Age", how many of them have an Italian translation?
Evidence: sets in the block "Ice Age" refers to block = 'Ice Age'; Italian translation refers to language = 'Italian'
SQL: SELECT COUNT(DISTINCT T1.id) FROM sets AS T1 INNER JOIN set_translations AS T2 ON T2.setCode = T1.code WHERE T1.block = 'Ice Age' AND T2.language = 'Italian' AND T2.translation IS NOT NULL
Database: card_games
Question: Among the sets of cards that have an Italian translation, how many of them have a base set number of under 10?
Evidence: Italian translation refers to language = 'Italian'; have a translation means translation is not null; base set number of under 10 refers to baseSetSize < 10
SQL: 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 < 10 AND T2.language = 'Italian'
Database: card_games
Question: Among the cards with converted mana cost higher than 5 in the set Coldsnap, how many of them have unknown power?
Evidence: card set Coldsnap refers to name = 'Coldsnap'; converted mana cost higher than 5 refers to convertedManaCost > 5; unknown power refers to power = '*' or T1.power is null
SQL: SELECT SUM(CASE WHEN T1.power LIKE '%*%' OR T1.power IS NULL THEN 1 ELSE 0 END) FROM cards AS T1 INNER JOIN sets AS T2 ON T2.code = T1.setCode WHERE T2.name = 'Coldsnap' AND T1.convertedManaCost > 5
Database: card_games
Question: Please list the Italian names of the cards in the set Coldsnap with the highest converted mana cost.
Evidence: card set Coldsnap refers to name = 'Coldsnap'; Italian refers to language = 'Italian'
SQL: SELECT T2.name 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' ORDER BY T2.convertedManaCost DESC LIMIT 1
Database: card_games
Question: What is the percentage of incredibly powerful cards in the set Coldsnap?
Evidence: card set Coldsnap refers to name = 'Coldsnap'; foil is incredibly powerful refers to cardKingdomFoilId = cardKingdomId AND cardKingdomId is not null; the percentage of incredibly powerful cards in the set refers to DIVIDE(SUM(incredibly powerful), SUM(name = 'Coldsnap'))*100


SQL: 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'
Database: card_games
Question: How many translations of the name of the set "Salvat 2011"?
Evidence: translations of the name refers to translation; translation is not NULL; set "Salvat 2011" refers to name = 'Salvat 2011'
SQL: SELECT COUNT(DISTINCT T2.translation) FROM sets AS T1 INNER JOIN set_translations AS T2 ON T2.setCode = T1.code WHERE T1.name = 'Salvat 2011' AND T2.translation IS NOT NULL
Database: card_games
Question: How many cards with unknown power that can't be found in foil is in duel deck A?
Evidence: unknown power refers to power IS NULL or power = '*'; can't be found in foil refers to hasFoil = 0; duel deck A refers to duelDeck = 'a'
SQL: SELECT SUM(CASE WHEN power LIKE '%*%' OR power IS NULL THEN 1 ELSE 0 END) FROM cards WHERE hasFoil = 0 AND duelDeck = 'a'
Database: card_games
Question: How many cards did Volkan BaÇµa illustrated whose foreign language is in French?
Evidence: Volkan BaÇµa refers to artist = 'Volkan Baga'; foreign language is in French refers to language = 'French'
SQL: SELECT COUNT(T3.id) FROM ( SELECT T1.id FROM cards AS T1 INNER JOIN foreign_data AS T2 ON T2.uuid = T1.uuid WHERE T1.artist = 'Volkan Baǵa' AND T2.language = 'French' GROUP BY T1.id ) AS T3
Database: card_games
Question: Which of the play formats has the highest number of banned status? Indicate the play format and the name of the card.
Evidence: play format refers to format uuid; banned status refers to status = 'banned'; the highest number of banned status refers to MAX(status = 'banned')
SQL: SELECT T2.format, T1.name FROM cards AS T1 INNER JOIN legalities AS T2 ON T2.uuid = T1.uuid WHERE T2.status = 'Banned' GROUP BY T2.format ORDER BY COUNT(T2.status) DESC LIMIT 1
Database: card_games
Question: Which cards are ranked 1st on EDHRec? List all of the cards name and its banned play format.
Evidence: ranked 1st on EDHRec refers to edhrecRank = 1; banned refers to status = 'banned'; play format refers to format; cards name refers to name
SQL: 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
Database: card_games
Question: List the names of all the cards in the set Hour of Devastation and find the formats in which these cards are legal.
Evidence: the set Hour of Devastation refers to set.name = 'Hour of Devastation'; names of all the cards in the set refers to cards.name; legal cards refers to status = 'legal'; the formats refers to format
SQL: SELECT DISTINCT T2.name , CASE WHEN T1.status = 'Legal' THEN T1.format ELSE NULL END FROM legalities AS T1 INNER JOIN cards AS T2 ON T2.uuid = T1.uuid WHERE T2.setCode IN ( SELECT code FROM sets WHERE name = 'Hour of Devastation' )
Database: card_games
Question: List all the frame styles and cards Allen Williams worked on and find any banned cards if there are any.
Evidence: frame styles refers to frameVersion; cards Allen Williams worked on refers to artist = 'Allen Williams'; banned cards refers to status = 'banned'
SQL: SELECT DISTINCT T1.frameVersion, T1.name , IIF(T2.status = 'Banned', T1.name, 'NO') FROM cards AS T1 INNER JOIN legalities AS T2 ON T1.uuid = T2.uuid WHERE T1.artist = 'Allen Williams'
Database: codebase_community
Question: Please list the display names of all the users whose accounts were created in the year 2014.
Evidence: account created in the year 2014 refers to year(CreationDate) = 2014
SQL: SELECT DisplayName FROM users WHERE STRFTIME('%Y', CreationDate) = '2014'
Database: codebase_community
Question: How many users last accessed the website after 2014/9/1?
Evidence: last accessed after 2014/9/1 refers to LastAccessDate > '2014-09-01 00:00:00'
SQL: SELECT COUNT(Id) FROM users WHERE date(LastAccessDate) > '2014-09-01'
Database: codebase_community
Question: Among the posts with a score of over 20, what is the percentage of them being owned by an elder user?
Evidence: score of over 20 refers to Score > 20; elder user refers to Age > 65; percentage = Divide (Count(Id where Age>65), Count(Id)) * 100
SQL: SELECT CAST(SUM(IIF(T2.Age > 65, 1, 0)) AS REAL) * 100 / COUNT(T1.Id) FROM posts AS T1 INNER JOIN users AS T2 ON T1.OwnerUserId = T2.Id WHERE T1.Score > 20
Database: codebase_community
Question: Provide the display name of the user who made the vote No.6347.
Evidence: vote no. 381800 refers to Id = '6347'
SQL: SELECT T1.DisplayName FROM users AS T1 INNER JOIN votes AS T2 ON T1.Id = T2.UserId WHERE T2.Id = 6347
Database: codebase_community
Question: Who is the editor of the post titled 'Open source tools for visualizing multi-dimensional data?'
Evidence: 'Open source tools for visualizing multi-dimensional data' is the Title of Post
SQL: 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?'
Database: codebase_community
Question: What is the total score of the posts edited by Yevgeny and include the user's website URL.
Evidence: "Yevgeny" is the DisplayName; edited refers to LastEditorUserId
SQL: SELECT SUM(T1.Score), T2.WebsiteUrl FROM posts AS T1 INNER JOIN users AS T2 ON T1.OwnerUserId = T2.Id WHERE T2.DisplayName = 'Yevgeny' GROUP BY T2.WebsiteUrl
Database: codebase_community
Question: Which user added a bounty amount of 50 to the post title mentioning variance?
Evidence: "bounty amount of 50 refers to BountyAmount = 50; user refers to DisplayName
SQL: 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%'
Database: codebase_community
Question: Calculate the average view count of posts tagged as 'humor' and write the title and the comments of the posts alongside their scores if applicable.
Evidence: "humor" is the Tags; comment of the post refers to Text; average view count = AVG(ViewCount)
SQL: SELECT AVG(T2.ViewCount), T2.Title, T1.Text FROM comments AS T1 INNER JOIN posts AS T2 ON T1.Id = T1.PostId WHERE T2.Tags = '<humor>'
Database: codebase_community
Question: How many users are awarded with more than 5 badges?
Evidence: more than 5 badges refers to Count (Name) > 5; user refers to UserId
SQL: SELECT UserId FROM ( SELECT UserId, COUNT(Name) AS num FROM badges GROUP BY UserId ) T WHERE T.num > 5
Database: codebase_community
Question: What is the percentage difference of student badges given during 2010 and 2011?
Evidence: "Students" is the Name of badge;  during 2010 refers to Year(Date) = 2010; 2011 refers to Year(Date) = 2011; percentage difference = Subtract (Divide(Count(Name where Year(Date) = 2010), Count (Name)) *100, Divide(Count(Name where Year(Date) = 2011), Count(Name)) * 100)
SQL: SELECT CAST(SUM(IIF(STRFTIME('%Y', Date) = '2010', 1, 0)) AS REAL) * 100 / COUNT(Id) - CAST(SUM(IIF(STRFTIME('%Y', Date) = '2011', 1, 0)) AS REAL) * 100 / COUNT(Id) FROM badges WHERE Name = 'Student'
Database: codebase_community
Question: What is the average of the up votes and the average user age for users creating more than 10 posts?
Evidence: creating more than 10 post refers to Count (UserId) > 10; up votes average = Divide (Sum(UpVotes), Count (UserId)); average age = Divide (Sum(Age), Count(UserId))
SQL: SELECT AVG(T1.UpVotes), AVG(T1.Age) FROM users AS T1 INNER JOIN ( SELECT OwnerUserId, COUNT(*) AS post_count FROM posts GROUP BY OwnerUserId HAVING post_count > 10) AS T2 ON T1.Id = T2.OwnerUserId
Database: codebase_community
Question: List out the name of badges that users obtained on 7/19/2010 7:39:08 PM.
Evidence: on 7/19/2010 7:39:08 PM refers to Date = '2010-07-19 19:39:08'
SQL: SELECT Name FROM badges WHERE Date = '2010-07-19 19:39:08.0'
Database: codebase_community
Question: What are the names of badges that users who have the highest reputation obtained?
Evidence: highest reputation refers to Max(Reputation); user refers to UserId
SQL: SELECT T2.name FROM users AS T1 INNER JOIN badges AS T2 ON T1.Id = T2.UserId ORDER BY T1.Reputation DESC LIMIT 1
Database: codebase_community
Question: What is the name of tags used by John Stauffer's?
Evidence: DisplayName = 'John Stauffer';
SQL: SELECT T3.Tags FROM users AS T1 INNER JOIN postHistory AS T2 ON T1.Id = T2.UserId INNER JOIN posts AS T3 ON T2.PostId = T3.Id WHERE T1.DisplayName = 'John Salvatier'
Database: codebase_community
Question: Which post by slashnick has the most answers count? State the post ID.
Evidence: most answers count refers to MAX(AnswerCount); DisplayName = 'slashnick';
SQL: SELECT T2.PostId FROM users AS T1 INNER JOIN postHistory AS T2 ON T1.Id = T2.UserId INNER JOIN posts AS T3 ON T2.PostId = T3.Id WHERE T1.DisplayName = 'slashnick' ORDER BY T3.AnswerCount DESC LIMIT 1
Database: codebase_community
Question: Among posts by Harvey Motulsky and Noah Snyder, which one has higher popularity?
Evidence: Higher view count means the post has higher popularity; MAX(SUM(ViewCount)) where DisplayName = 'Harvey Motulsky' OR DisplayName = 'Noah Snyder';
SQL: SELECT T1.DisplayName FROM users AS T1 INNER JOIN postHistory AS T2 ON T1.Id = T2.UserId INNER JOIN posts AS T3 ON T2.PostId = T3.Id WHERE T1.DisplayName = 'Harvey Motulsky' OR T1.DisplayName = 'Noah Snyder' GROUP BY T1.DisplayName ORDER BY SUM(T3.ViewCount) DESC LIMIT 1
Database: codebase_community
Question: State all the tags used by Mark Meckes in his posts that doesn't have comments.
Evidence: DisplayName = 'Mark Meckes';
SQL: SELECT T3.Tags FROM users AS T1 INNER JOIN postHistory AS T2 ON T1.Id = T2.UserId INNER JOIN posts AS T3 ON T3.Id = T2.PostId WHERE T1.DisplayName = 'Mark Meckes' AND T3.CommentCount = 0
Database: codebase_community
Question: Based on posts posted by Community, calculate the percentage of posts that use the R language.
Evidence: DIVIDE(COUNT(PostId WHERE TagName = R language)), (COUNT(PostId WHERE DisplayName = 'Community')) as percentage; R language refers to tagname = 'r'
SQL: SELECT CAST(SUM(IIF(T3.TagName = 'r', 1, 0)) AS REAL) * 100 / COUNT(T1.Id) FROM users AS T1 INNER JOIN postHistory AS T2 ON T1.Id = T2.UserId INNER JOIN tags AS T3 ON T3.ExcerptPostId = T2.PostId WHERE T1.DisplayName = 'Community'
Database: codebase_community
Question: Calculate the difference in view count from post posted by mornington and view count from posts posted by Amos.
Evidence: SUBTRACT(SUM(ViewCount where DisplayName = 'Mornington'), SUM(ViewCount where DisplayName = 'Amos'));
SQL: SELECT SUM(IIF(T1.DisplayName = 'Mornington', T3.ViewCount, 0)) - SUM(IIF(T1.DisplayName = 'Amos', T3.ViewCount, 0)) AS diff FROM users AS T1 INNER JOIN postHistory AS T2 ON T1.Id = T2.UserId INNER JOIN posts AS T3 ON T3.Id = T2.PostId
Database: codebase_community
Question: How many users received commentator badges in 2014?
Evidence: commentator is the name of the badge; year(Date) = 2014;
SQL: SELECT COUNT(Id) FROM badges WHERE Name = 'Commentator' AND STRFTIME('%Y', Date) = '2014'
Database: codebase_community
Question: What is the score of the post with the most popular tag?
Evidence: Higher view count means the post has higher popularity; the most popular tag refers to MAX(Count);
SQL: SELECT Score FROM posts WHERE Id = ( SELECT ExcerptPostId FROM tags ORDER BY Count DESC LIMIT 1 )
Database: codebase_community
Question: What is the average monthly number of links created in 2010 for posts that have no more than 2 answers?
Evidence: DIVIDE(COUNT(Id where YEAR(CreationDate) = 2010 and AnswerCount < = 2), 12)
SQL: 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'
Database: codebase_community
Question: When did "chl" cast its first vote in a post?
Evidence: DisplayName = 'chl'; cast its first vote refers to MIN(CreationDate);
SQL: SELECT T2.CreationDate FROM users AS T1 INNER JOIN votes AS T2 ON T1.Id = T2.UserId WHERE T1.DisplayName = 'chl' ORDER BY T2.CreationDate LIMIT 1
Database: codebase_community
Question: What is the percentage of posts whose owners had a reputation of over 1000 in 2011?
Evidence: DIVIDE(COUNT(Id where CreationDate = 2011 and Reputation > 1000), COUNT(Id) ) * 100 as percentage;
SQL: SELECT CAST(SUM(IIF(STRFTIME('%Y', T2.CreaionDate) = '2011' AND T1.Reputation > 1000, 1, 0)) AS REAL) * 100 / COUNT(T1.Id) FROM users AS T1 INNER JOIN posts AS T2 ON T1.Id = T2.OwnerUserId
Database: codebase_community
Question: Identify the total views on the post 'Computer Game Datasets'. Name the user who posted it last time.
Evidence: views refer to ViewCount; Name the user refers to DisplayName; Text = 'Computer Game Datasets';
SQL: SELECT T2.ViewCount, T3.DisplayName FROM postHistory AS T1 INNER JOIN posts AS T2 ON T1.PostId = T2.Id INNER JOIN users AS T3 ON T2.LastEditorUserId = T3.Id WHERE T1.Text = 'Computer Game Datasets'
Database: codebase_community
Question: Identify the display name and location of the user, who was the last to edit the post with ID 183.
Evidence: last to edit refers to MAX(LastEditDate);
SQL: SELECT T2.DisplayName, T2.Location FROM posts AS T1 INNER JOIN users AS T2 ON T1.OwnerUserId = T2.Id WHERE T2.Id = 183 ORDER BY T1.LastEditDate DESC LIMIT 1
Database: codebase_community
Question: Provide the text of the latest comment to the post with the title 'Analysing wind data with R' and the display name of the user who left it.
Evidence: the latest comment refers to MAX(CreationDate);
SQL: SELECT T3.Text, T1.DisplayName 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 T2.Title = 'Analysing wind data with R' ORDER BY T1.CreationDate DESC LIMIT 1
Database: codebase_community
Question: Among all the posts posted by the most influential user, identify the percentage with a score above 50.
Evidence: The user with higher reputation has more influence; DIVIDE(COUNT(stats_posts.Id where Score > = 50 and MAX(Reputation))), COUNT(stats_posts.Id where MAX(Reputation)) as percentage;
SQL: SELECT CAST(SUM(CASE WHEN T2.Score >= 50 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.Id) FROM users T1 INNER JOIN posts T2 ON T1.Id = T2.OwnerUserId INNER JOIN ( SELECT MAX(Reputation) AS max_reputation FROM users ) T3 ON T1.Reputation = T3.max_reputation
Database: codebase_community
Question: Give the texts commented on the post about linear regression.
Evidence: Title = 'How can I adapt ANOVA for binary data?';
SQL: SELECT T1.Text FROM comments AS T1 INNER JOIN posts AS T2 ON T1.PostId = T2.Id WHERE T2.Title LIKE '%linear regression%'
Database: codebase_community
Question: Among products comments with 0 score, what is the total number of users ages 40 years old?
SQL: SELECT COUNT(T1.id) FROM comments AS T1 INNER JOIN users AS T2 ON T1.UserId = T2.Id WHERE T1.Score = 0 AND T2.Age = 40
Database: codebase_community
Question: Among the comments with scores between 5 to 10, what is the percentage of the users with 0 up votes?
Evidence: DIVIDE(COUNT(UserId where UpVotes = 0 and Score BETWEEN 5 and 10)), (COUNT(UserId where Score BETWEEN 5 and 10)) as percentage;
SQL: SELECT CAST(SUM(IIF(T1.UpVotes = 0, 1, 0)) AS REAL) / COUNT(T1.Id) AS per FROM users AS T1 INNER JOIN comments AS T2 ON T1.Id = T2.UserId WHERE T2.Score BETWEEN 5 AND 10
Database: superhero
Question: Please give the full name of the tallest hero published by Marvel Comics.
Evidence: the tallest hero refers to MAX(height_cm); published by Marvel Comics refers to publisher_name = 'Marvel Comics'
SQL: SELECT T1.full_name FROM superhero AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.id WHERE T2.publisher_name = 'Marvel Comics' ORDER BY T1.height_cm DESC LIMIT 1
Database: superhero
Question: Among the superheroes from Marvel Comics, how many of them have blue eyes?
Evidence: the superheroes from Marvel Comics refers to publisher_name = 'Marvel Comics'; blue eyes refers to colour = 'Blue' and eye_colour_id = colour.id
SQL: 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 = 'Blue'
Database: superhero
Question: Among the superheroes from Marvel Comics, what is the percentage of those who have the super power of "Super Strength"?
Evidence: the superheroes from Marvel Comics refers to publisher_name = 'Marvel Comics'; super power of "Super Strength" refers to power_name = 'Super Strength'; Calculation = MULTIPLY(DIVIDE(SUM(power_name = 'Super Strength'), COUNT(id)), 100)
SQL: SELECT CAST(COUNT(CASE WHEN T3.power_name = 'Super Strength' THEN T1.id ELSE NULL END) AS REAL) * 100 / COUNT(T1.id) FROM superhero AS T1 INNER JOIN hero_power AS T2 ON T1.id = T2.hero_id INNER JOIN superpower AS T3 ON T2.power_id = T3.id INNER JOIN publisher AS T4 ON T1.publisher_id = T4.id WHERE T4.publisher_name = 'Marvel Comics'
Database: superhero
Question: How many superheroes have durability of less than 50?
Evidence: durability of less than 50 refers to attribute_name = 'Durability' AND attribute_value < 50
SQL: SELECT COUNT(T1.hero_id) FROM hero_attribute AS T1 INNER JOIN attribute AS T2 ON T1.attribute_id = T2.id WHERE T2.attribute_name = 'Durability' AND T1.attribute_value < 50
Database: superhero
Question: What is the average weight of all female superheroes?
Evidence: female refers to gender_id = 2; average weight refers to AVG(weight_kg)
SQL: SELECT AVG(T1.weight_kg) FROM superhero AS T1 INNER JOIN gender AS T2 ON T1.gender_id = T2.id WHERE T2.gender = 'Female'
Database: superhero
Question: Among the superheroes with height from 170 to 190, list the names of the superheroes with no eye color.
Evidence: height from 170 to 190 refers to height_cm BETWEEN 170 AND 190; no eye color refers to eye_colour_id = 1
SQL: SELECT DISTINCT T1.superhero_name FROM superhero AS T1 INNER JOIN colour AS T2 ON T1.eye_colour_id = T2.id WHERE T1.height_cm BETWEEN 170 AND 190 AND T2.colour LIKE 'No Colour'
Database: superhero
Question: In superheroes with height between 150 to 180, what is the percentage of heroes published by Marvel Comics?
Evidence: height between 150 to 180 refers to height_cm BETWEEN 150 AND 180; heroes published by Marvel Comics refers to publisher_id = 13; calculation = MULTIPLY(DIVIDE(SUM(publisher.id = 13)), COUNT(publisher.id), 100)
SQL: SELECT CAST(COUNT(CASE WHEN T2.publisher_name = 'Marvel Comics' 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 WHERE T1.height_cm BETWEEN 150 AND 180
Database: superhero
Question: Among the male superheroes, list the full names of superheroes with weight greater than the 79% average weight of all superheroes.
Evidence: Calculation = weight_kg > MULTIPLY(AVG(weight_kg), 0.79)
SQL: SELECT T1.full_name FROM superhero AS T1 INNER JOIN gender AS T2 ON T1.gender_id = T2.id WHERE T2.gender = 'Male' AND T1.weight_kg * 100 > ( SELECT AVG(weight_kg) FROM superhero ) * 79
Database: superhero
Question: What is the percentage of blue female superheroes among all female superheroes?
Evidence: percentage = MULTIPLY(DIVIDE(SUM(colour = 'Blue' WHERE gender = 'Female'), COUNT(gender = 'Female')), 100); blue refers to the color; female refers to gender = 'Female';
SQL: 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'
Database: superhero
Question: Which superheroes have blue eyes with brown hair?
Evidence: which superheroes refers to superhero_name; blue eyes refers to eye_colour_id = 7; brown hair refers to hair_colour_id = 9;
SQL: SELECT T1.superhero_name FROM superhero AS T1 INNER JOIN colour AS T2 ON T1.eye_colour_id = T2.id INNER JOIN colour AS T3 ON T1.hair_colour_id = T3.id WHERE T2.colour = 'Blue' AND T3.colour = 'Brown'
Database: superhero
Question: Calculate the percentage of superheroes with blue eyes.
Evidence: percentage = MULTIPLY(DIVIDE(SUM(superhero_name WHERE eye_colour_id = 7), COUNT(superhero_name)), 100.0); blue eyes refers to eye_colour_id = 7;
SQL: SELECT CAST(COUNT(CASE WHEN T2.colour = 'Blue' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.id) FROM superhero AS T1 INNER JOIN colour AS T2 ON T1.eye_colour_id = T2.id
Database: superhero
Question: Find the ratio between male superheroes and female superheroes.
Evidence: ratio = DIVIDE(SUM(gender_id = 1) / SUM(gender_id = 2)); male superheroes refers to gender_id = 1; female superheroes refers to gender_id = 2;
SQL: SELECT CAST(COUNT(CASE WHEN T2.gender = 'Male' THEN T1.id ELSE NULL END) AS REAL) / COUNT(CASE WHEN T2.gender = 'Female' THEN T1.id ELSE NULL END) FROM superhero AS T1 INNER JOIN gender AS T2 ON T1.gender_id = T2.id
Database: superhero
Question: Give the alignment and superpowers of the superhero named Atom IV.
Evidence: superpowers refers to power_name;
SQL: SELECT T3.power_name FROM superhero AS T1 INNER JOIN hero_power AS T2 ON T1.id = T2.hero_id INNER JOIN superpower AS T3 ON T3.id = T2.power_id WHERE T1.superhero_name = 'Atom IV'
Database: superhero
Question: List down at least five full names of superheroes with blue eyes.
Evidence: blue eyes refers to colour.colour = 'Blue' WHERE eye_colour_id = colour.id;
SQL: SELECT T1.superhero_name FROM superhero AS T1 INNER JOIN colour AS T2 ON T1.eye_colour_id = T2.id WHERE T2.colour = 'Blue' LIMIT 5
Database: superhero
Question: Count the fastest superheroes.
Evidence: fastest refers to attribute_value = 100 WHERE attribute_name = 'Speed';
SQL: SELECT COUNT(T3.superhero_name) FROM hero_attribute AS T1 INNER JOIN attribute AS T2 ON T1.attribute_id = T2.id INNER JOIN superhero AS T3 ON T1.hero_id = T3.id WHERE T2.attribute_name = 'Speed' ORDER BY T1.attribute_value DESC LIMIT 1
Database: superhero
Question: Which publisher created more superheroes: DC or Marvel Comics? Find the difference in the number of superheroes.
Evidence: DC refers to publisher_name = 'DC Comics'; Marvel Comics refers to publisher_name = 'Marvel Comics'; if SUM(publisher_name = 'DC Comics') > SUM(publisher_name = 'Marvel Comics'), it means DC Comics published more superheroes than Marvel Comics; if SUM(publisher_name = 'Marvel Comics') > SUM(publisher_name = 'Marvel Comics'), it means Marvel Comics published more heroes than DC Comics; difference = SUBTRACT(SUM(publisher_name = 'DC Comics'), SUM(publisher_name = 'Marvel Comics'));
SQL: SELECT SUM(CASE WHEN T2.publisher_name = 'DC Comics' THEN 1 ELSE 0 END) - SUM(CASE WHEN T2.publisher_name = 'Marvel Comics' THEN 1 ELSE 0 END) FROM superhero AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.id
Database: formula_1
Question: Please list the reference names of the drivers who are eliminated in the first period in race number 18.
Evidence: driver reference name refers to driverRef; first qualifying period refers to q1; drivers who are eliminated in the first qualifying period refers to 5 drivers with MAX(q1); race number refers to raceId;
SQL: SELECT T2.driverRef FROM qualifying AS T1 INNER JOIN drivers AS T2 ON T2.driverId = T1.driverId WHERE T1.raceId = 18 ORDER BY T1.q1 DESC LIMIT 5
Database: formula_1
Question: What is the surname of the driver with the best lap time in race number 19 in the second period?
Evidence: race number refers to raceId; second qualifying period refers to q2; best lap time refers to MIN(q2);
SQL: SELECT T2.surname FROM qualifying AS T1 INNER JOIN drivers AS T2 ON T2.driverId = T1.driverId WHERE T1.raceId = 19 AND T1.q2 IS NOT NULL ORDER BY T1.q2 ASC LIMIT 1
Database: formula_1
Question: What is the location coordinates of the circuits for Australian grand prix?
Evidence: coordinates refers to (lat, lng);
SQL: 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'
Database: formula_1
Question: Give the coordinate position for Abu Dhabi Grand Prix.
Evidence: coordinates refers to (lat, lng); position and location shares the same meaning.
SQL: SELECT DISTINCT T1.lat, T1.lng, T1.location FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T2.name = 'Abu Dhabi Grand Prix'
Database: formula_1
Question: What's Bruno Senna's Q1 result in the qualifying race No. 354?
Evidence: race number refers to raceId;
SQL: SELECT T1.q1 FROM qualifying AS T1 INNER JOIN drivers AS T2 ON T2.driverId = T1.driverId WHERE T1.raceId = 354 AND T2.forename = 'Bruno' AND T2.surname = 'Senna'
Database: formula_1
Question: What is his number of the driver who finished 0:01:54 in the Q3 of qualifying race No.903?
Evidence: race number refers to raceId;
SQL: 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%'
Database: formula_1
Question: For the Bahrain Grand Prix in 2007, how many drivers not finished the game?
Evidence: drivers who finished the race refers to time has records;
SQL: SELECT COUNT(T3.driverId) 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 = 2007 AND T1.name = 'Bahrain Grand Prix' AND T2.time IS NULL
Database: formula_1
Question: For all the drivers who finished the game in race No. 592, who is the oldest?
Evidence: drivers who finished the race refers to time is not empty; oldest driver refers to oldest dob;
SQL: SELECT T1.forename, T1.surname FROM drivers AS T1 INNER JOIN results AS T2 ON T2.driverId = T1.driverId WHERE T2.raceId = 592 AND T2.time IS NOT NULL AND T1.dob IS NOT NULL ORDER BY T1.dob ASC LIMIT 1
Database: formula_1
Question: Who was the player that got the lap time of 0:01:27 in the race No. 161? Show his introduction website.
Evidence: player and driver are synonyms; race number refers to raceId; introduction website of the drivers refers to url;
SQL: SELECT DISTINCT T2.forename, T2.surname, T2.url FROM lapTimes AS T1 INNER JOIN drivers AS T2 ON T2.driverId = T1.driverId WHERE T1.raceId = 161 AND T1.time LIKE '1:27%'
Database: formula_1
Question: Where is Malaysian Grand Prix held? Give the location coordinates.
Evidence: coordinates refers to (lat, lng);
SQL: SELECT DISTINCT T1.lat, T1.lng FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T2.name = 'Malaysian Grand Prix'
Database: formula_1
Question: For the constructor which got the highest point in the race No. 9 , what is its introduction website?
Evidence: race number refers to raceId; introduction website of the constructor refers to url;
SQL: SELECT T2.url FROM constructorResults AS T1 INNER JOIN constructors AS T2 ON T2.constructorId = T1.constructorId WHERE T1.raceId = 9 ORDER BY T1.points DESC LIMIT 1
Database: formula_1
Question: In the race No. 45, for the driver who had the Q3 time as 0:01:33, what is his abbreviated code?
Evidence: race number refers to raceId;
SQL: SELECT T2.code FROM qualifying AS T1 INNER JOIN drivers AS T2 ON T2.driverId = T1.driverId WHERE T1.raceId = 45 AND T1.q3 LIKE '1:33%'
Database: formula_1
Question: For the race happened in 2015/11/29, how many drivers finished the game?
SQL: SELECT COUNT(T2.driverId) FROM races AS T1 INNER JOIN results AS T2 ON T2.raceId = T1.raceId WHERE T1.date = '2015-11-29' AND T2.time IS NOT NULL
Database: formula_1
Question: For the driver who set the fastest lap speed, what is his nationality?
Evidence: the fastest lap speed refers to (MAX) fastestLapSpeed

SQL mentions raceId = 348, that is not in the question
SQL: SELECT T1.nationality FROM drivers AS T1 INNER JOIN results AS T2 ON T2.driverId = T1.driverId WHERE T2.fastestLapTime IS NOT NULL ORDER BY T2.fastestLapSpeed DESC LIMIT 1
Database: formula_1
Question: Paul di Resta was in the No. 853 race, what percent faster did he finish in the 853rd race than the next race for the fastest lap speed?
Evidence: race number refers to raceId; DIVIDE(SUBTRACT(fastestLapSpeed(raceId = 853), (fastestLapSpeed (raceId = 854)), (fastestLapSpeed(raceId = 853)) as percentage
SQL: SELECT (SUM(IIF(T2.raceId = 853, T2.fastestLapSpeed, 0)) - SUM(IIF(T2.raceId = 854, T2.fastestLapSpeed, 0))) * 100 / SUM(IIF(T2.raceId = 853, T2.fastestLapSpeed, 0)) FROM drivers AS T1 INNER JOIN results AS T2 ON T2.driverId = T1.driverId WHERE T1.forename = 'Paul' AND T1.surname = 'di Resta'
Database: formula_1
Question: For the drivers who took part in the race in 1983/7/16, what's their race completion rate?
Evidence: DIVIDE(COUNT(driverid where time has value and date = '1983-07-16'), (COUNT(driverid where date = '1983-07-16')) as percentage
SQL: 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'
Database: formula_1
Question: Name the first race recorded. What are the other races that happened within the same month and year of that race.
Evidence: the first race refers to year = year(min(date)) and month = month(min(date));
SQL: SELECT name FROM races WHERE STRFTIME('%Y', date) = ( SELECT STRFTIME('%Y', date) FROM races ORDER BY date ASC LIMIT 1 ) AND STRFTIME('%m', date) = ( SELECT STRFTIME('%m', date) FROM races ORDER BY date ASC LIMIT 1 )
Database: formula_1
Question: State the driver with the most points scored. Find his full name with that points.
Evidence: the most points scored refers to max(points); full name contains forename and surname.
SQL: SELECT T3.forename, T3.surname, T2.points FROM races AS T1 INNER JOIN driverStandings AS T2 ON T2.raceId = T1.raceId INNER JOIN drivers AS T3 ON T3.driverId = T2.driverId ORDER BY T2.points DESC LIMIT 1
Database: formula_1
Question: What is the best lap time recorded? List the driver and race with such recorded lap time.
Evidence: the best lap time refers to min(time)
SQL: SELECT T2.milliseconds, T1.forename, T1.surname, T3.name FROM drivers AS T1 INNER JOIN lapTimes AS T2 ON T1.driverId = T2.driverId INNER JOIN races AS T3 ON T2.raceId = T3.raceId ORDER BY T2.milliseconds ASC LIMIT 1
Database: formula_1
Question: What is the average lap time for Sebastian Vettel in the 2009 Chinese Grand Prix?
Evidence: AVG(time);
SQL: SELECT AVG(T2.milliseconds) FROM races AS T1 INNER JOIN lapTimes AS T2 ON T2.raceId = T1.raceId INNER JOIN drivers AS T3 ON T3.driverId = T2.driverId WHERE T3.forename = 'Sebastian' AND T3.surname = 'Vettel' AND T1.year = 2009 AND T1.name = 'Chinese GrAND Prix'
Database: formula_1
Question: Calculate the percentage whereby Hamilton was not at the 1st track of the the f1 circuit since 2010.
Evidence: DIVIDE(COUNT(raceId) where surname = 'Hamilton', year >= 2010 and position>1), (COUNT(raceId) where surname = 'Hamilton', year >= 2010) as percentage;
SQL: SELECT CAST(COUNT(CASE WHEN T2.position <> 1 THEN T2.position END) AS REAL) * 100 / COUNT(T2.driverStandingsId) FROM races AS T1 INNER JOIN driverStandings AS T2 ON T2.raceId = T1.raceId INNER JOIN drivers AS T3 ON T3.driverId = T2.driverId WHERE T3.surname = 'Hamilton' AND T1.year >= 2010
Database: formula_1
Question: Name the driver with the most winning. Mention his nationality and what is his average point scores.
Evidence: the most winning refers to MAX(COUNT(wins)); avg(points);
SQL: SELECT T1.forename, T1.surname, T1.nationality, AVG(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
Database: formula_1
Question: How old is the youngest Japanese driver? What is his name?
Evidence: youngest Japanese driver refers to max(dob); Japanese refers to nationality = 'Japanese'; age = 2022-year(dob)+1

SQL: SELECT STRFTIME('%Y', CURRENT_TIMESTAMP) - STRFTIME('%Y', dob), forename , surname FROM drivers WHERE nationality = 'Japanese' ORDER BY dob DESC LIMIT 1
Database: formula_1
Question: Name the races along with its circuit name and location for f1 races hosted in September 2005.
Evidence: in September 2005 refers to month(date) = 9 and year = 2005
SQL: 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'
Database: formula_1
Question: Which race was Alex Yoong in when he was in track number less than 10?
Evidence: track number less than 10 refers to position < 10
SQL: SELECT T1.name FROM races AS T1 INNER JOIN driverStandings AS T2 ON T2.raceId = T1.raceId INNER JOIN drivers AS T3 ON T3.driverId = T2.driverId WHERE T3.forename = 'Alex' AND T3.surname = 'Yoong' AND T2.position < 10
Database: formula_1
Question: State the race and year of race in which Michael Schumacher had his fastest lap.
Evidence: fastest lap refers to min(milliseconds)
SQL: SELECT T1.name, T1.year FROM races AS T1 INNER JOIN lapTimes AS T2 ON T2.raceId = T1.raceId INNER JOIN drivers AS T3 ON T3.driverId = T2.driverId WHERE T3.forename = 'Michael' AND T3.surname = 'Schumacher' ORDER BY T2.milliseconds ASC LIMIT 1
Database: formula_1
Question: Which was Lewis Hamilton first race? What was his points recorded for his first race event?
Evidence: first race refers to min(Year)
SQL: SELECT T1.name, T2.points FROM races AS T1 INNER JOIN driverStandings AS T2 ON T2.raceId = T1.raceId INNER JOIN drivers AS T3 ON T3.driverId = T2.driverId WHERE T3.forename = 'Lewis' AND T3.surname = 'Hamilton' ORDER BY T1.year ASC LIMIT 1
Database: formula_1
Question: Among all European Grand Prix races, what is the percentage of the races were hosted in Germany?
Evidence: percentage = divide(COUNT(races where country = Germany and name = 'Europearn Grand Prix'),COUNT(races where name = 'Europearn Grand Prix'))*100
SQL: SELECT CAST(COUNT(CASE WHEN T1.country = 'Germany' THEN T2.circuitID END) AS REAL) * 100 / COUNT(T2.circuitId) FROM circuits AS T1 INNER JOIN races AS T2 ON T2.circuitID = T1.circuitId WHERE T2.name = 'European Grand Prix'
Database: formula_1
Question: What's the location coordinates of Silverstone Circuit?
Evidence: coordinates refers to (lat, lng)
SQL: SELECT lat, lng FROM circuits WHERE name = 'Silverstone Circuit'
Database: formula_1
Question: What's the reference name of Marina Bay Street Circuit?
Evidence: reference name refers to circuitRef
SQL: SELECT circuitRef FROM circuits WHERE name = 'Marina Bay Street Circuit'
Database: formula_1
Question: Which country is the oldest driver from?
Evidence: oldest driver refers to min(dob)
SQL: SELECT nationality FROM drivers WHERE dob IS NOT NULL ORDER BY dob ASC LIMIT 1
Database: formula_1
Question: Which driver ranked the first in the Australian Grand Prix in 2008? Please give his reference name.
Evidence: reference name refers to driverRef
SQL: 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 = 'Australian Grand Prix' AND T2.rank = 1 AND T1.year = 2008
Database: formula_1
Question: In which Formula_1 race did Lewis Hamilton rank the highest?
Evidence: rank the highest refers to min(rank)
SQL: SELECT name FROM races WHERE raceId IN ( SELECT raceId FROM results WHERE rank = 1 AND driverId = ( SELECT driverId FROM drivers WHERE forename = 'Lewis' AND surname = 'Hamilton' ) )
Database: formula_1
Question: What was the fastest lap speed among all drivers in the 2009 Spanish Grand Prix?
Evidence: the fastest lap speed among all refers to max(fastestLapSpeed)
SQL: 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
Database: formula_1
Question: What was Lewis Hamilton's final rank in the 2008 Australian Grand Prix?
Evidence: final rank refers to positionOrder
SQL: 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 = 'Australian Grand Prix' AND T1.year = 2008
Database: formula_1
Question: Which driver was in the no. 4 grid formation when starting the race in 2008's Australian Grand Prix? Please give his forename and surname.
Evidence: the no. 4 grid formation refers to grid = 4
SQL: 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 = 2008
Database: formula_1
Question: What's the finish time for the driver who ranked second in 2008's Australian Grand Prix?
Evidence: finish time refers to time
SQL: SELECT T1.time FROM results AS T1 INNER JOIN races AS T2 on T1.raceId = T2.raceId WHERE T1.rank = 2 AND T2.name = 'Australian Grand Prix' AND T2.year = 2008