Chinastark/bird_dataset huggingface dataset:
Database: card_games
Note: 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';
Question: How many cards with unknown power that can't be found in foil is in duel deck A?
SQL: SELECT sum(CASE WHEN power = '*' OR power IS NULL THEN 1 ELSE 0 END) FROM cards WHERE hasfoil = 0 AND dueldeck = 'a'
Database: card_games
Note: expansion type refers to type where type = 'commander'; totalsetsize: The total number of cards in the set, including promotional and related supplemental products but excluding Alchemy modifications; highest total number of cards refers to MAX(totalsetsize);
Question: Among the sets whose expansion type is Commander, which set has the highest total number of cards including promotional and related supplemental products but excluding Alchemy modifications? Indicate the id of the set.
SQL: SELECT id FROM SETS WHERE TYPE = 'commander' ORDER BY totalsetsize DESC LIMIT 1
Database: card_games
Note: duels refer to format = 'duel'; the highest uncoverted mana cost refers to MAX(manacost);
Question: In duels, what are the top 10 cards with the highest uncoverted mana cost?
SQL: SELECT DISTINCT name FROM cards WHERE UUID IN ( SELECT UUID FROM legalities WHERE format = 'duel' ) ORDER BY manacost DESC LIMIT 0, 10
Database: card_games
Note: the oldest card refers to MIN(originalreleasedate); mythic card refers to rarity = 'mythic'; legal play refers to status = 'legal'; play format refers to format;
Question: When was the oldest mythic card released and what are its legal play formats?
SQL: SELECT cards.originalreleasedate, legalities.format FROM cards INNER JOIN legalities ON cards.uuid = legalities.uuid WHERE cards.rarity = 'mythic' AND cards.originalreleasedate IS NOT NULL AND legalities.status = 'Legal' ORDER BY cards.originalreleasedate LIMIT 1
Database: card_games
Note: Volkan BaÇµa refers to artist = 'Volkan Baǵa'; foreign language is in French refers to language = 'French';
Question: How many cards did Volkan BaÇµa illustrated whose foreign language is in French?
SQL: SELECT count(t3.id) FROM ( SELECT cards.id FROM cards INNER JOIN foreign_data ON foreign_data.uuid = cards.uuid WHERE cards.artist = 'Volkan Baǵa' AND foreign_data.language = 'French' GROUP BY cards.id ) AS t3
Database: card_games
Note: rare refers to rarity = 'rare'; enchantment card refers to types = 'Enchantment'; Abundance cards refers to name = 'Abundance'; format status are all legal refers to status = 'Legal';
Question: How many rare enchantment Abundance cards are there whose play format status are all legal?
SQL: SELECT count(cards.id) FROM cards INNER JOIN legalities ON legalities.uuid = cards.uuid WHERE cards.rarity = 'rare' AND cards.types = 'Enchantment' AND cards.name = 'Abundance' AND legalities.status = 'Legal'
Database: card_games
Note: play format refers to format; banned status refers to status = 'Banned'; the highest number of banned status refers to MAX(COUNT(status = 'Banned'));
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.
SQL: WITH maxbanned AS (SELECT format, count(*) AS count_banned FROM legalities WHERE status = 'Banned' GROUP BY format ORDER BY count(*) DESC LIMIT 1) SELECT legalities.format, cards.name FROM cards INNER JOIN legalities ON legalities.uuid = cards.uuid INNER JOIN maxbanned mb ON mb.format = legalities.format WHERE legalities.status = 'Banned'
Database: card_games
Note: "Battlebond" set refers to name = 'Battlebond';
Question: What is the language of the "Battlebond" set?
SQL: SELECT LANGUAGE FROM set_translations WHERE id IN ( SELECT id FROM SETS WHERE name = 'Battlebond' )
Database: card_games
Note: format of the cards refers to format; illustrator refers to artist; the least amount of cards refers to MIN(artist);
Question: Who is the illustrator that illustrated the least amount of cards? List the format of play of the cards that he/she illustrated.
SQL: SELECT cards.artist, legalities.format FROM cards INNER JOIN legalities ON legalities.uuid = cards.uuid GROUP BY cards.artist ORDER BY count(cards.id) ASC LIMIT 1
Database: card_games
Note: version of frame style is 1997 refers to frameversion = '1997'; illustrated by D. Alexander Gregory refers to artist = 'D. Alexander Gregory'; sensitive content refers to hascontentwarning = 1; legacy play format refers to format = 'legacy'; status of the card refers to status;
Question: Among the cards whose version of frame style is 1997, what is the status of the card illustrated by D. Alexander Gregory in legacy play format that has sensitive content or Wizards of the Coast?
SQL: SELECT DISTINCT legalities.status FROM cards INNER JOIN legalities ON legalities.uuid = cards.uuid WHERE cards.frameversion = 1997 AND cards.hascontentwarning = 1 AND cards.artist = 'D. Alexander Gregory' AND legalities.format = 'legacy'
Database: card_games
Note: ranked 1st on EDHRec refers to edhrecrank = 1; banned refers to status = 'Banned'; play format refers to format; cards name refers to name;
Question: Which cards are ranked 1st on EDHRec? List all of the cards name and its banned play format.
SQL: SELECT cards.name, legalities.format FROM cards INNER JOIN legalities ON legalities.uuid = cards.uuid WHERE cards.edhrecrank = 1 AND legalities.status = 'Banned' GROUP BY cards.name, legalities.format
Database: card_games
Note: AVG(id); releasedate BETWEEN 1/1/2012 AND 12/31/2015; the common language refers to MAX(COUNT(language));
Question: What is the annual average number of sets that were released between 1/1/2012 to 12/31/2015? Indicate the common langugage of the card.
SQL: SELECT (cast(sum(SETS.id) AS REAL) / count(SETS.id)) / 4, set_translations.language FROM SETS INNER JOIN set_translations ON SETS.id = set_translations.id WHERE SETS.releasedate BETWEEN '2012-01-01' AND '2015-12-31' GROUP BY SETS.releasedate ORDER BY count(set_translations.language) DESC LIMIT 1
Database: card_games
Note: black borders refers to bordercolor = 'black'; available only in arena refers to availability = 'arena';
Question: List the artists who illustrated cards with black borders which are available only in arena.
SQL: SELECT DISTINCT artist FROM cards WHERE availability = 'arena' AND bordercolor = 'black'
Database: card_games
Note: old school format refers to format = 'oldschool'; restricted or banned refers to status = 'banned' or 'restricted';
Question: Find the uuid of cards in which the old school format is restricted or banned.
SQL: SELECT UUID FROM legalities WHERE format = 'oldschool' AND (status = 'Banned' OR status = 'Restricted')
Database: card_games
Note: card designed by Matthew D. Wilson refers to artist = 'Matthew D. Wilson'; available only in the paper refers to availability = 'paper';
Question: Among the card designed by Matthew D. Wilson, how many are available only in the paper?
SQL: SELECT count(id) FROM cards WHERE artist = 'Matthew D. Wilson' AND availability = 'paper'
Database: card_games
Note: rulings refers to text; card named and designed by Kev Walker refers to artist = 'Kev Walker'; descending order of dates refers to MAX(date);
Question: What are the rulings for the card named and designed by Kev Walker? List them in descending order of dates.
SQL: SELECT rulings.text FROM cards INNER JOIN rulings ON rulings.uuid = cards.uuid WHERE cards.artist = 'Kev Walker' ORDER BY rulings.date DESC
Database: card_games
Note: 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;
Question: List the names of all the cards in the set Hour of Devastation and find the formats in which these cards are legal.
SQL: SELECT DISTINCT cards.name , CASE WHEN legalities.status = 'Legal' THEN legalities.format ELSE NULL END FROM legalities INNER JOIN cards ON cards.uuid = legalities.uuid WHERE cards.setcode IN ( SELECT code FROM SETS WHERE name = 'Hour of Devastation' )
Database: card_games
Note: names of sets refers to name; doesn't have Japanese translation refers to language not like '%Japanese%'; have Korean translation refers to language = 'Korean';
Question: Find and list the names of sets which doesn't have Japanese translation but have Korean translation.
SQL: SELECT name FROM SETS WHERE code IN ( SELECT setcode FROM set_translations WHERE LANGUAGE = 'Korean' AND LANGUAGE NOT LIKE '%Japanese%' )
Database: card_games
Note: frame styles refers to frameversion; cards Allen Williams worked on refers to artist = 'Allen Williams'; banned cards refers to status = 'Banned';
Question: List all the frame styles and cards Allen Williams worked on and find any banned cards if there are any.
SQL: SELECT DISTINCT cards.frameversion, cards.name , iif(legalities.status = 'Banned', cards.name, 'NO') FROM cards INNER JOIN legalities ON cards.uuid = legalities.uuid WHERE cards.artist = 'Allen Williams'
Database: codebase_community
Note: "Harlan" and "Jarrod Dixon" are both displayname; highest reputation refers to Max(reputation);
Question: Which user has a higher reputation, Harlan or Jarrod Dixon?
SQL: SELECT displayname FROM users WHERE displayname IN ('Harlan', 'Jarrod Dixon') AND reputation = ( SELECT max(reputation) FROM users WHERE displayname IN ('Harlan', 'Jarrod Dixon') )
Database: codebase_community
Note: account created in the year 2011 refers to year(creationdate) = 2011;
Question: Please list the display names of all the users whose accounts were created in the year 2011.
SQL: SELECT displayname FROM users WHERE strftime('%Y', creationdate) = '2011'
Database: codebase_community
Note: last accessed after 2014/9/1 refers to lastaccessdate > '2014-09-01';
Question: How many users last accessed the website after 2014/9/1?
SQL: SELECT count(id) FROM users WHERE date(lastaccessdate) > '2014-09-01'
Database: codebase_community
Note: user who has the most number of view refers to Max(views);
Question: What is the display name of the user who has the most number of views?
SQL: SELECT displayname FROM users WHERE VIEWS = ( SELECT max(VIEWS) FROM users )
Database: codebase_community
Note: more than 100 upvotes refers to upvotes > 100; more than 1 downvotes refers to downvotes > 1;
Question: Among the users who have more than 100 upvotes, how many of them have more then 1 downvotes?
SQL: SELECT count(id) FROM users WHERE upvotes > 100 AND downvotes > 1
Database: codebase_community
Note: more than 10 views refers to views > 10; created after the year 2013 refers to year (creationdate) > 2013;
Question: How many users with more than 10 views created their account after the year 2013?
SQL: SELECT count(id) FROM users WHERE strftime('%Y', creationdate) > '2013' AND VIEWS > 10
Database: codebase_community
Note: "csgillespie" is the displayname of user;
Question: How many posts does the user csgillespie own?
SQL: SELECT count(posts.id) FROM posts INNER JOIN users ON posts.owneruserid = users.id WHERE users.displayname = 'csgillespie'
Database: codebase_community
Note: "csgillespie" is the displayname of user;
Question: Please list the titles of the posts owned by the user csgillespie?
SQL: SELECT posts.title FROM posts INNER JOIN users ON posts.owneruserid = users.id WHERE users.displayname = 'csgillespie'
Database: codebase_community
Note: "Eliciting priors from experts" is the title of post; owner refers to displayname;
Question: Who is the owner of the post "Eliciting priors from experts"?
SQL: SELECT users.displayname FROM posts INNER JOIN users ON posts.owneruserid = users.id WHERE posts.title = 'Eliciting priors from experts'
Database: codebase_community
Note: "csgillespie" is the displayname of user; highest popularity refers to Max(viewcount);
Question: What is the title of the post that is owned by csgillespie and has the highest popularity?
SQL: SELECT posts.title FROM posts INNER JOIN users ON posts.owneruserid = users.id WHERE users.displayname = 'csgillespie' ORDER BY posts.viewcount DESC LIMIT 1
Database: codebase_community
Note: most valuable post refers to Max(favoritecount);
Question: What is the display name of the user who is the owner of the most valuable post?
SQL: SELECT users.displayname FROM posts INNER JOIN users ON posts.owneruserid = users.id ORDER BY posts.favoritecount DESC LIMIT 1
Database: codebase_community
Note: "csgillespie" is the displayname of user; total number of comments refers to Sum(commentcount);
Question: What is the total number of comments of all the posts owned by csgillespie?
SQL: SELECT sum(posts.commentcount) FROM posts INNER JOIN users ON posts.owneruserid = users.id WHERE users.displayname = 'csgillespie'
Database: codebase_community
Note: "csgillespie" is the displayname of user; the most number of answer refers to Max(answercount);
Question: For the post that got the most number of answers owned by csgillespie, how many answers did it get?
SQL: SELECT max(posts.answercount) FROM posts INNER JOIN users ON posts.owneruserid = users.id WHERE users.displayname = 'csgillespie'
Database: codebase_community
Note: "Examples for teaching: Correlation does not mean causation" is the title of post; user who last edited refers to lasteditoruserid;
Question: What is the display name of the user who last edited the post "Examples for teaching: Correlation does not mean causation"?
SQL: SELECT users.displayname FROM posts INNER JOIN users ON posts.lasteditoruserid = users.id WHERE posts.title = 'Examples for teaching: Correlation does not mean causation'
Database: codebase_community
Note: "csgillespie" is the displayname of user; root post refers to parentid IS Null;
Question: Among the posts owned by csgillespie, how many of them are root posts?
SQL: SELECT count(posts.id) FROM posts INNER JOIN users ON posts.owneruserid = users.id WHERE users.displayname = 'csgillespie' AND posts.parentid IS NULL
Database: codebase_community
Note: the post that is well-finished refers to closeddate IS NOT Null;
Question: Please list the display names of all the users who owns a post that is well-finished.
SQL: SELECT users.displayname FROM posts INNER JOIN users ON posts.owneruserid = users.id WHERE posts.closeddate IS NOT NULL
Database: codebase_community
Note: elder users refers to age > 65; score of over 19 refers to score >= 20;
Question: Among the posts owned by an elder user, how many of them have a score of over 19?
SQL: SELECT count(posts.id) FROM posts INNER JOIN users ON posts.owneruserid = users.id WHERE posts.score >= 20 AND users.age > 65
Database: codebase_community
Note: Owner refers to owneruserid; 'Eliciting priors from experts' is the title of post;
Question: What is the location of the owner of the post "Eliciting priors from experts"?
SQL: SELECT users.location FROM posts INNER JOIN users ON posts.owneruserid = users.id WHERE posts.title = 'Eliciting priors from experts'
Database: codebase_community
Note: "bayesian" is the tagname; excerpt from refers to excerptpostid;
Question: From which post is the tag "bayesian" excerpted from? Please give the body of the post.
SQL: SELECT posts.body FROM tags INNER JOIN posts ON posts.id = tags.excerptpostid WHERE tags.tagname = 'bayesian'
Database: codebase_community
Note: most popular tag refers to Max(count); excerpt from refer to excerptpostid;
Question: From which post is the most popular tag excerpted from? Please give the body of the post.
SQL: SELECT BODY FROM posts WHERE id = ( SELECT excerptpostid FROM tags ORDER BY COUNT DESC LIMIT 1 )
Database: codebase_community
Note: "csgillespie" is the displayname of user;
Question: How many badges has the user csgillespie obtained?
SQL: SELECT count(badges.id) FROM badges INNER JOIN users ON badges.userid = users.id WHERE users.displayname = 'csgillespie'
Database: codebase_community
Note: "csgillespie" is the displayname of user;
Question: Please list the names of the badges obtained by csgillespie.
SQL: SELECT badges.`name` FROM badges INNER JOIN users ON badges.userid = users.id WHERE users.displayname = 'csgillespie'
Database: codebase_community
Note: "csgillespie" is the displayname of user; obtained in 2011 refers to YEAR (date) = 2011;
Question: Among the badges obtained by csgillespie, how many of them were obtained in the year 2011?
SQL: SELECT count(badges.id) FROM badges INNER JOIN users ON badges.userid = users.id WHERE strftime('%Y', badges.date) = '2011' AND users.displayname = 'csgillespie'
Database: codebase_community
Note: who obtained the most number of badges refers to userid with Max(count(id));
Question: What is the display name of the user who has obtained the most number of badges?
SQL: SELECT users.displayname FROM badges INNER JOIN users ON badges.userid = users.id GROUP BY users.displayname ORDER BY count(badges.id) DESC LIMIT 1
Database: codebase_community
Note: "csgillespie" is the displayname of user; average score refers to AVG(score);
Question: What is the average score of the posts owned by the user csgillespie?
SQL: SELECT avg(posts.score) FROM posts INNER JOIN users ON posts.owneruserid = users.id WHERE users.displayname = 'csgillespie'
Database: codebase_community
Note: user with over 200 views refers to views > 200; average number of badges = Divide (count(id), count(displayname));
Question: What is the average number of badges obtained by a user with over 200 views?
SQL: SELECT cast(count(badges.id) AS REAL) / count(DISTINCT users.displayname) FROM badges INNER JOIN users ON badges.userid = users.id WHERE users.views > 200
Database: codebase_community
Note: score of over 5 refers to score > 5; elder user refers to age > 65; percentage = Divide (count(id where age>65), count(id)) * 100;
Question: Among the posts with a score of over 5, what is the percentage of them being owned by an elder user?
SQL: SELECT cast(sum(iif(users.age > 65, 1, 0)) AS REAL) * 100 / count(posts.id) FROM posts INNER JOIN users ON posts.owneruserid = users.id WHERE posts.score > 5
Database: codebase_community
Note: user no. 58 refers to userid = 58; on 2010/7/19 refers to creationdate = '2010-07-19';
Question: How many votes did the user No.58 take on 2010/7/19?
SQL: SELECT count(id) FROM votes WHERE userid = 58 AND creationdate = '2010-07-19'
Database: codebase_community
Note: the creation date of the maximum number of votes refers to creationdate where Max(count(id));
Question: Indicate the creation date of the maximum number of votes.
SQL: SELECT creationdate FROM votes GROUP BY creationdate ORDER BY count(id) DESC LIMIT 1
Database: codebase_community
Note: number refers to id; 'Revival' is the name of badge;
Question: Give the number of "Revival" badges.
SQL: SELECT count(id) FROM badges WHERE name = 'Revival'
Database: codebase_community
Note: highest score comment refers to Max(comments.score);
Question: What is the title for the post which got the highest score comment?
SQL: SELECT title FROM posts WHERE id = ( SELECT postid FROM comments ORDER BY score DESC LIMIT 1 )
Database: codebase_community
Question: For the post which got 1910 view counts, how many comments does it get?
SQL: SELECT count(posts.id) FROM posts INNER JOIN comments ON posts.id = comments.postid WHERE posts.viewcount = 1910
Database: codebase_community
Note: user no. 3025 refers to userid = '3025'; comment at 20:29:39 on 2014/4/23 refers to creationdate = '2014/4/23 20:29:39.0';
Question: User No.3025 gave a comment at 20:29:39 on 2014/4/23 to a post, how many favorite counts did that post get?
SQL: SELECT posts.favoritecount FROM posts INNER JOIN comments ON posts.id = comments.postid WHERE comments.creationdate = '2014-04-23 20:29:39.0' AND comments.userid = 3025
Database: codebase_community
Note: one comment refers to commentcount = '1';
Question: Give the only one comment text of the post with parent id 107829.
SQL: SELECT comments.text FROM posts INNER JOIN comments ON posts.id = comments.postid WHERE posts.parentid = 107829 AND posts.commentcount = 1
Database: codebase_community
Note: user no. 23853 refers to userid = '23853'; at 9:08:18 on 2013/7/12 refers to creationdate = '2013-07-12 09:08:18.0'; not well-finished refers to closeddate IS NULL and vice versa;
Question: User No.23853 gave a comment to a post at 9:08:18 on 2013/7/12, was that post well-finished?
SQL: SELECT iif(posts.closeddate IS NULL, 'NOT well-finished', 'well-finished') AS resylt FROM comments INNER JOIN posts ON comments.postid = posts.id WHERE comments.userid = 23853 AND comments.creationdate = '2013-07-12 09:08:18.0'
Database: codebase_community
Note: post no. 65041 refers to id = '65041'; reputation point refers to reputation;
Question: For the owner user of post No. 65041, what is his/her reputation points?
SQL: SELECT users.reputation FROM users INNER JOIN posts ON users.id = posts.owneruserid WHERE posts.id = 65041
Database: codebase_community
Note: "Tiago Pasqualini" is the displayname;
Question: For the user with the display name of "Tiago Pasqualini", how many posts did he/she own?
SQL: SELECT count(users.id) FROM users INNER JOIN posts ON users.id = posts.owneruserid WHERE users.displayname = 'Tiago Pasqualini'
Database: codebase_community
Note: vote no. 6347 refers to id = '6347';
Question: Provide the display name of the user who made the vote No.6347.
SQL: SELECT users.displayname FROM users INNER JOIN votes ON users.id = votes.userid WHERE votes.id = 6347
Database: codebase_community
Note: About data visualization is the title that contains 'data visualization';
Question: Give the number of votes for the post about data visualization.
SQL: SELECT count(posts.id) FROM posts INNER JOIN votes ON posts.id = votes.postid WHERE posts.title LIKE '%data visualization%'
Database: codebase_community
Note: "datepicCoderGuyWhoPrograms" is the displayname;
Question: For the user whose display name is "DatEpicCoderGuyWhoPrograms", what is his/her badge's name?
SQL: SELECT badges.name FROM users INNER JOIN badges ON users.id = badges.userid WHERE users.displayname = 'DatEpicCoderGuyWhoPrograms'
Database: codebase_community
Note: user no. 24 refers to userid = owneruserid = '24'; times of his/her post than votes = Divide (count(post.id), count(votes.id));
Question: For the user No.24, how many times is the number of his/her posts compared to his/her votes?
SQL: SELECT cast(count(posts.id) AS REAL) / count(DISTINCT votes.id) FROM votes INNER JOIN posts ON votes.userid = posts.owneruserid WHERE votes.userid = 24
Database: codebase_community
Note: "Integration of Weka and/or RapidMiner into Informatica PowerCenter/Developer" is the title of post; views refers to viewcount;
Question: How many views did the post titled 'Integration of Weka and/or RapidMiner into Informatica PowerCenter/Developer' get?
SQL: SELECT viewcount FROM posts WHERE title = 'Integration of Weka and/or RapidMiner into Informatica PowerCenter/Developer'
Database: codebase_community
Note: score of 17 refers to score = 17; contents of comments refers to text;
Question: Write the contents of comments with a score of 17.
SQL: SELECT Text FROM comments WHERE score = 17
Database: codebase_community
Note: "http://stackoverflow.com" is the websiteurl; user refers to displayname;
Question: Which user has the website URL listed at 'http://stackoverflow.com'
SQL: SELECT displayname FROM users WHERE websiteurl = 'http://stackoverflow.com'
Database: codebase_community
Note: "SilentGhost" is the displayname of user;
Question: What is the badge name that user 'SilentGhost' obtained?
SQL: SELECT badges.name FROM users INNER JOIN badges ON users.id = badges.userid WHERE users.displayname = 'SilentGhost'
Database: codebase_community
Note: "thank you user93" is the text of comment; user refers to displayname;
Question: Name the user that commented 'thank you user93!'
SQL: SELECT users.displayname FROM users INNER JOIN comments ON users.id = comments.userid WHERE comments.text = 'thank you user93!'
Database: codebase_community
Note: "A Lion" is the displayname of user; comment refers to text;
Question: Write all comments made by user 'A Lion.'
SQL: SELECT comments.text FROM users INNER JOIN comments ON users.id = comments.userid WHERE users.displayname = 'A Lion'