Dludora/Bird-minidev-sqlserver-oracle huggingface dataset:
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 (SQLite): SELECT translation FROM set_translations WHERE setCode IN ( SELECT setCode FROM cards WHERE name = 'Ancestor''s Chosen' ) AND language = 'Italian'
SQL (SQL Server): SELECT translation FROM set_translations WHERE setCode IN ( SELECT setCode FROM cards WHERE name = 'Ancestor''s Chosen' ) AND language = 'Italian'
SQL (Oracle): SELECT translation FROM set_translations WHERE setCode IN ( SELECT setCode FROM cards WHERE name = 'Ancestor''s Chosen' ) AND language = 'Italian'

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 (SQLite): 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'
SQL (SQL Server): 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'
SQL (Oracle): SELECT CASE WHEN SUM(CASE WHEN T2.language = 'Korean' AND T2.translation IS NOT NULL THEN CAST(1 AS BINARY_DOUBLE) ELSE 0.0 END) > 0 THEN 'YES' ELSE 'NO' END FROM cards T1 INNER JOIN set_translations T2 ON T2.setCode = T1.setCode WHERE T1.name = 'Ancestor''s Chosen'

Question: Among the cards in the set "Hauptset Zehnte Edition", how many of them are designed by Adam Rex?
Evidence: card set "Hauptset Zehnte Edition" refers to translation = 'Hauptset Zehnte Edition'; designed by Adam refers to artist = 'Adam Rex'
SQL (SQLite): SELECT COUNT(T1.id) FROM cards AS T1 INNER JOIN set_translations AS T2 ON T2.setCode = T1.setCode WHERE T2.translation = 'Hauptset Zehnte Edition' AND T1.artist = 'Adam Rex'
SQL (SQL Server): SELECT COUNT(T1.id) AS _agg1 FROM cards AS T1 INNER JOIN set_translations AS T2 ON T2.setCode = T1.setCode WHERE T2.translation = 'Hauptset Zehnte Edition' AND T1.artist = 'Adam Rex'
SQL (Oracle): SELECT COUNT(T1.id) FROM cards T1 INNER JOIN set_translations T2 ON T2.setCode = T1.setCode WHERE T2.translation = 'Hauptset Zehnte Edition' AND T1.artist = 'Adam Rex'
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 refers to language = 'Chinese Simplified'; translation of the name refers to translation
SQL (SQLite): 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'
SQL (SQL Server): 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'
SQL (Oracle): SELECT T2.translation FROM sets T1 INNER JOIN set_translations T2 ON T2.setCode = T1.code WHERE T1.name = 'Eighth Edition' AND T2.language = 'Chinese Simplified'

Question: Did the set of cards with "Angel of Mercy" appear on Magic: The Gathering Online?
Evidence: card set "Angel of Mercy" refers to name = 'Angel of Mercy'; appear on Magic: The Gathering Online refers to mtgoCode is NOT NULL and vice versa
SQL (SQLite): SELECT IIF(T2.mtgoCode IS NOT NULL, 'YES', 'NO') FROM cards AS T1 INNER JOIN sets AS T2 ON T2.code = T1.setCode WHERE T1.name = 'Angel of Mercy'
SQL (SQL Server): SELECT IIF(T2.mtgoCode IS NOT NULL, 'YES', 'NO') FROM cards AS T1 INNER JOIN sets AS T2 ON T2.code = T1.setCode WHERE T1.name = 'Angel of Mercy'
SQL (Oracle): SELECT CASE WHEN T2.mtgoCode IS NOT NULL THEN 'YES' ELSE 'NO' END FROM cards T1 INNER JOIN sets T2 ON T2.code = T1.setCode WHERE T1.name = 'Angel of Mercy'

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' and translation is not null
SQL (SQLite): 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
SQL (SQL Server): SELECT COUNT(DISTINCT T1.id) AS _agg1 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
SQL (Oracle): SELECT COUNT(DISTINCT T1.id) FROM sets T1 INNER JOIN set_translations T2 ON T2.setCode = T1.code WHERE T1.block = 'Ice Age' AND T2.language = 'Italian' AND T2.translation IS NOT NULL

Question: Is the set of cards with Adarkar Valkyrie only available outside the United States?
Evidence: card set Adarkar Valkyrie refers to name = 'Adarkar Valkyrie'; isForeignOnly = 1 means only available outside the United States;
SQL (SQLite): 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'
SQL (SQL Server): 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'
SQL (Oracle): SELECT CASE WHEN isForeignOnly = 1 THEN 'YES' ELSE 'NO' END FROM cards T1 INNER JOIN sets T2 ON T2.code = T1.setCode WHERE T1.name = 'Adarkar Valkyrie'
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 100?
Evidence: Italian translation refers to language = 'Italian'; have a translation means translation is not null; base set number of under 100 refers to baseSetSize < 10
SQL (SQLite): 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'
SQL (SQL Server): SELECT COUNT(T1.id) AS _agg1 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'
SQL (Oracle): SELECT COUNT(T1.id) FROM sets T1 INNER JOIN set_translations T2 ON T2.setCode = T1.code WHERE T2.translation IS NOT NULL AND T1.baseSetSize < 100 AND T2.language = 'Italian'

Question: Which of these artists have designed a card in the set Coldsnap, Jeremy Jarvis, Aaron Miller or Chippy?
Evidence: card set Coldsnap refers to name = 'Coldsnap'; Jeremy Jarvis, Aaron Miller or Chippy are the name of artists which refers to artist IN ('Jeremy Jarvis', 'Aaron Miller','Chippy');
SQL (SQLite): SELECT T1.artist FROM cards AS T1 INNER JOIN sets AS T2 ON T2.code = T1.setCode WHERE (T2.name = 'Coldsnap' AND T1.artist = 'Chippy') OR (T2.name = 'Coldsnap' AND T1.artist = 'Aaron Miller') OR (T2.name = 'Coldsnap' AND T1.artist = 'Jeremy Jarvis') GROUP BY T1.artist
SQL (SQL Server): SELECT T1.artist FROM cards AS T1 INNER JOIN sets AS T2 ON T2.code = T1.setCode WHERE (T2.name = 'Coldsnap' AND T1.artist = 'Chippy') OR (T2.name = 'Coldsnap' AND T1.artist = 'Aaron Miller') OR (T2.name = 'Coldsnap' AND T1.artist = 'Jeremy Jarvis') GROUP BY T1.artist
SQL (Oracle): SELECT T1.artist FROM cards T1 INNER JOIN sets T2 ON T2.code = T1.setCode WHERE (T2.name = 'Coldsnap' AND T1.artist = 'Chippy') OR (T2.name = 'Coldsnap' AND T1.artist = 'Aaron Miller') OR (T2.name = 'Coldsnap' AND T1.artist = 'Jeremy Jarvis') GROUP BY T1.artist

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 (SQLite): SELECT SUM(CASE WHEN T1.power = '*' 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
SQL (SQL Server): SELECT SUM(CASE WHEN T1.power = '*' OR T1.power IS NULL THEN 1 ELSE 0 END) AS _agg1 FROM cards AS T1 INNER JOIN sets AS T2 ON T2.code = T1.setCode WHERE T2.name = 'Coldsnap' AND T1.convertedManaCost > 5
SQL (Oracle): SELECT SUM(CASE WHEN T1.power = '*' OR T1.power IS NULL THEN CAST(1 AS BINARY_DOUBLE) ELSE 0.0 END) FROM cards T1 INNER JOIN sets T2 ON T2.code = T1.setCode WHERE T2.name = 'Coldsnap' AND T1.convertedManaCost > 5
Database: card_games

Question: What is the Italian flavor text of the card "Ancestor's Chosen"?
Evidence: Italian refers to language = 'Italian'; flavor text refers to flavorText; "Ancestor''s Chosen" refers to name = 'Ancestor''s Chosen'
SQL (SQLite): 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'
SQL (SQL Server): 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'
SQL (Oracle): SELECT T2.flavorText FROM cards T1 INNER JOIN foreign_data T2 ON T2.uuid = T1.uuid WHERE T1.name = 'Ancestor''s Chosen' AND T2.language = 'Italian'

Question: Please list the Italian text ruling of all the cards in the set Coldsnap.
Evidence: card set Coldsnap refers to name = 'Coldsnap'; Italian refers to language = 'Italian'
SQL (SQLite): 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'
SQL (SQL Server): 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'
SQL (Oracle): SELECT DISTINCT T1.text FROM foreign_data T1 INNER JOIN cards T2 ON T2.uuid = T1.uuid INNER JOIN sets T3 ON T3.code = T2.setCode WHERE T3.name = 'Coldsnap' AND T1.language = 'Italian'

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'; highest converted mana cost refers to MAX(convertedManaCost)
SQL (SQLite): 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
SQL (SQL Server): 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
SQL (Oracle): SELECT T2.name FROM foreign_data T1 INNER JOIN cards T2 ON T2.uuid = T1.uuid INNER JOIN sets T3 ON T3.code = T2.setCode WHERE T3.name = 'Coldsnap' AND T1.language = 'Italian' ORDER BY T2.convertedManaCost DESC
Database: card_games

Question: What is the percentage of the cards with a converted mana cost of 7 in the set Coldsnap?
Evidence: converted mana cost of 7 refers to convertedManaCost = 7; card set Coldsnap refers to name = 'Coldsnap'; percentage = DIVIDE(SUM(convertedManaCost = 7), SUM(convertedManaCost))*100
SQL (SQLite): SELECT CAST(SUM(CASE WHEN T1.convertedManaCost = 7 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'
SQL (SQL Server): SELECT TRY_CAST(SUM(CASE WHEN T1.convertedManaCost = 7 THEN 1 ELSE 0 END) AS FLOAT) * 100 / COUNT(T1.id) AS _agg1 FROM cards AS T1 INNER JOIN sets AS T2 ON T2.code = T1.setCode WHERE T2.name = 'Coldsnap'
SQL (Oracle): SELECT CAST(SUM(CASE WHEN T1.convertedManaCost = 7 THEN CAST(1 AS BINARY_DOUBLE) ELSE 0.0 END) AS BINARY_DOUBLE) * 100 / COUNT(T1.id) FROM cards T1 INNER JOIN sets T2 ON T2.code = T1.setCode WHERE T2.name = 'Coldsnap'

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 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
SQL (SQLite): 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'
SQL (SQL Server): SELECT TRY_CAST(SUM(CASE WHEN T1.cardKingdomFoilId IS NOT NULL AND T1.cardKingdomId IS NOT NULL THEN 1 ELSE 0 END) AS FLOAT) * 100 / COUNT(T1.id) AS _agg1 FROM cards AS T1 INNER JOIN sets AS T2 ON T2.code = T1.setCode WHERE T2.name = 'Coldsnap'
SQL (Oracle): SELECT CAST(SUM(CASE WHEN T1.cardKingdomFoilId IS NOT NULL AND T1.cardKingdomId IS NOT NULL THEN CAST(1 AS BINARY_DOUBLE) ELSE 0.0 END) AS BINARY_DOUBLE) * 100 / COUNT(T1.id) FROM cards T1 INNER JOIN sets T2 ON T2.code = T1.setCode WHERE T2.name = 'Coldsnap'
Database: card_games

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.
Evidence: play format refers to format; banned status refers to status = 'Banned'; the highest number of banned status refers to MAX(COUNT(status = 'Banned'))
SQL (SQLite): 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'
SQL (SQL Server): WITH MaxBanned AS (SELECT format, COUNT(*) AS count_banned FROM legalities WHERE status = 'Banned' GROUP BY format ORDER BY COUNT(*) DESC OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY) 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'
SQL (Oracle): WITH MaxBanned AS (SELECT format, COUNT(*) count_banned FROM legalities WHERE status = 'Banned' GROUP BY format ORDER BY COUNT(*) DESC NULLS LAST FETCH FIRST 1 ROWS ONLY) SELECT T2.format, T1.name FROM cards T1 INNER JOIN legalities T2 ON T2.uuid = T1.uuid INNER JOIN MaxBanned MB ON MB.format = T2.format WHERE T2.status = 'Banned'

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 (SQLite): 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
SQL (SQL Server): 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
SQL (Oracle): SELECT T1.name, T2.format FROM cards T1 INNER JOIN legalities 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 (SQLite): 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' )
SQL (SQL Server): 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' )
SQL (Oracle): SELECT DISTINCT T2.name, CASE WHEN T1.status = 'Legal' THEN T1.format ELSE NULL END FROM legalities T1 INNER JOIN cards T2 ON T2.uuid = T1.uuid WHERE T2.setCode IN ( SELECT code FROM sets WHERE name = 'Hour of Devastation' )

Question: Find and list the names of sets which doesn't have Japanese translation but have Korean translation.
Evidence: names of sets refers to name; doesn't have Japanese translation refers to language not like '%Japanese%'; have Korean translation refers to language = 'Korean'
SQL (SQLite): SELECT name FROM sets WHERE code IN ( SELECT setCode FROM set_translations WHERE language = 'Korean' AND language NOT LIKE '%Japanese%' )
SQL (SQL Server): SELECT name FROM sets WHERE code IN ( SELECT setCode FROM set_translations WHERE language = 'Korean' AND language NOT LIKE '%Japanese%' )
SQL (Oracle): SELECT name FROM sets WHERE code IN ( SELECT setCode FROM set_translations WHERE language = 'Korean' AND language NOT LIKE '%Japanese%' )

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 (SQLite): 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'
SQL (SQL Server): 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'
SQL (Oracle): SELECT DISTINCT T1.frameVersion, T1.name, CASE WHEN T2.status = 'Banned' THEN T1.name ELSE 'NO' END FROM cards T1 INNER JOIN legalities T2 ON T1.uuid = T2.uuid WHERE T1.artist = 'Allen Williams'
Database: toxicology

Question: What is the most common bond type?
Evidence: most common bond type refers MAX(COUNT(bond_type))
SQL (SQLite): 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
SQL (SQL Server): SELECT T.bond_type FROM ( SELECT bond_type, COUNT(bond_id) AS _agg1 FROM bond GROUP BY bond_type ORDER BY COUNT(bond_id) DESC OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY ) AS T
SQL (Oracle): SELECT T.bond_type FROM ( SELECT bond_type, COUNT(bond_id) FROM bond GROUP BY bond_type ORDER BY COUNT(bond_id) DESC NULLS LAST FETCH FIRST 1 ROWS ONLY ) T

Question: Calculate the average number of oxygen atoms in single-bonded molecules.
Evidence: single-bonded molecules refers to bond_type = '-' ; average number of oxygen atom = AVG(element = 'o')
SQL (SQLite): SELECT AVG(oxygen_count) FROM (SELECT T1.molecule_id, COUNT(T1.element) AS oxygen_count FROM atom AS T1 INNER JOIN bond AS T2 ON T1.molecule_id = T2.molecule_id  WHERE T2.bond_type = '-' AND T1.element = 'o'  GROUP BY T1.molecule_id) AS oxygen_counts
SQL (SQL Server): SELECT AVG(TRY_CAST(oxygen_count AS FLOAT)) AS _agg1 FROM (SELECT T1.molecule_id, COUNT(T1.element) AS oxygen_count FROM atom AS T1 INNER JOIN bond AS T2 ON T1.molecule_id = T2.molecule_id  WHERE T2.bond_type = '-' AND T1.element = 'o'  GROUP BY T1.molecule_id) AS oxygen_counts
SQL (Oracle): SELECT AVG(oxygen_count) FROM (SELECT T1.molecule_id, COUNT(T1.element) oxygen_count FROM atom T1 INNER JOIN bond T2 ON T1.molecule_id = T2.molecule_id  WHERE T2.bond_type = '-' AND T1.element = 'o'  GROUP BY T1.molecule_id) oxygen_counts

Question: On average how many carcinogenic molecules are single bonded?
Evidence: carcinogenic molecules refers to label = '+'; single-bonded refers to bond_type = '-'; average = DIVIDE(SUM(bond_type = '-'), COUNT(atom_id))
SQL (SQLite): SELECT AVG(single_bond_count) FROM (SELECT T3.molecule_id, COUNT(T1.bond_type) AS single_bond_count FROM bond AS T1  INNER JOIN atom AS T2 ON T1.molecule_id = T2.molecule_id INNER JOIN molecule AS T3 ON T3.molecule_id = T2.molecule_id WHERE T1.bond_type = '-' AND T3.label = '+' GROUP BY T3.molecule_id) AS subquery
SQL (SQL Server): SELECT AVG(TRY_CAST(single_bond_count AS FLOAT)) AS _agg1 FROM (SELECT T3.molecule_id, COUNT(T1.bond_type) AS single_bond_count FROM bond AS T1  INNER JOIN atom AS T2 ON T1.molecule_id = T2.molecule_id INNER JOIN molecule AS T3 ON T3.molecule_id = T2.molecule_id WHERE T1.bond_type = '-' AND T3.label = '+' GROUP BY T3.molecule_id) AS subquery
SQL (Oracle): SELECT AVG(single_bond_count) FROM (SELECT T3.molecule_id, COUNT(T1.bond_type) single_bond_count FROM bond T1  INNER JOIN atom T2 ON T1.molecule_id = T2.molecule_id INNER JOIN molecule T3 ON T3.molecule_id = T2.molecule_id WHERE T1.bond_type = '-' AND T3.label = '+' GROUP BY T3.molecule_id) subquery
Database: toxicology

Question: Find the triple-bonded molecules which are carcinogenic.
Evidence: triple-bonded molecules refers to bond_type = '#'; carcinogenic refers to label = '+'
SQL (SQLite): SELECT DISTINCT T2.molecule_id FROM bond AS T1 INNER JOIN molecule AS T2 ON T1.molecule_id = T2.molecule_id WHERE T1.bond_type = '#' AND T2.label = '+'
SQL (SQL Server): SELECT DISTINCT T2.molecule_id FROM bond AS T1 INNER JOIN molecule AS T2 ON T1.molecule_id = T2.molecule_id WHERE T1.bond_type = '#' AND T2.label = '+'
SQL (Oracle): SELECT DISTINCT T2.molecule_id FROM bond T1 INNER JOIN molecule T2 ON T1.molecule_id = T2.molecule_id WHERE T1.bond_type = '#' AND T2.label = '+'

Question: What is the percentage of carbon in double-bond molecules?
Evidence: carbon refers to element = 'c'; double-bond molecules refers to bond_type = '='; percentage = DIVIDE(SUM(element = 'c'), COUNT(atom_id))
SQL (SQLite): SELECT CAST(COUNT(DISTINCT CASE WHEN T1.element = 'c' THEN T1.atom_id ELSE NULL END) AS REAL) * 100 / COUNT(DISTINCT T1.atom_id) FROM atom AS T1 INNER JOIN bond AS T2 ON T1.molecule_id = T2.molecule_id WHERE T2.bond_type = '='
SQL (SQL Server): SELECT TRY_CAST(COUNT(DISTINCT CASE WHEN T1.element = 'c' THEN T1.atom_id ELSE NULL END) AS FLOAT) * 100 / COUNT(DISTINCT T1.atom_id) AS _agg1 FROM atom AS T1 INNER JOIN bond AS T2 ON T1.molecule_id = T2.molecule_id WHERE T2.bond_type = '='
SQL (Oracle): SELECT CAST(COUNT(DISTINCT CASE WHEN T1.element = 'c' THEN T1.atom_id ELSE NULL END) AS BINARY_DOUBLE) * 100 / COUNT(DISTINCT T1.atom_id) FROM atom T1 INNER JOIN bond T2 ON T1.molecule_id = T2.molecule_id WHERE T2.bond_type = '='

Question: What elements are in the TR004_8_9 bond atoms?
Evidence: TR004_8_9 bond atoms refers to bond_id = 'TR004_8_9';
SQL (SQLite): SELECT DISTINCT T1.element FROM atom AS T1 INNER JOIN connected AS T2 ON T1.atom_id = T2.atom_id WHERE T2.bond_id = 'TR004_8_9'
SQL (SQL Server): SELECT DISTINCT T1.element FROM atom AS T1 INNER JOIN connected AS T2 ON T1.atom_id = T2.atom_id WHERE T2.bond_id = 'TR004_8_9'
SQL (Oracle): SELECT DISTINCT T1.element FROM atom T1 INNER JOIN connected T2 ON T1.atom_id = T2.atom_id WHERE T2.bond_id = 'TR004_8_9'

Question: What elements are in a double type bond?
Evidence: double type bond refers to bond_type = '=';
SQL (SQLite): 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 = '='
SQL (SQL Server): 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 = '='
SQL (Oracle): SELECT DISTINCT T1.element FROM atom T1 INNER JOIN bond T2 ON T1.molecule_id = T2.molecule_id INNER JOIN connected T3 ON T1.atom_id = T3.atom_id WHERE T2.bond_type = '='