db_id
stringclasses
68 values
question
stringlengths
33
321
evidence
stringlengths
0
673
SQL
stringlengths
116
743
question_id
int64
3
6.6k
difficulty
stringclasses
2 values
ice_hockey_draft
How tall is the player from Yale University who picked up 28 penalty minutes in the 2005-2006 season?
how tall refers to height_in_cm; Yale University refers to TEAM = 'Yale Univ.'; 28 penalty minutes refers to PIM = '28'; 2005-2006 season refers to SEASON = '2005-2006';
SELECT T3.height_in_cm FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID INNER JOIN height_info AS T3 ON T2.height = T3.height_id WHERE T1.SEASON = '2005-2006' AND T1.TEAM = 'Yale Univ.' AND T1.PIM = 28
1,489
moderate
ice_hockey_draft
How much taller is David Bornhammar than Pauli Levokari in centimeters?
how much taller = SUBTRACT(SUM(height_in_cm WHERE PlayerName = 'David Bornhammar'), SUM(height_in_cm WHERE PlayerName = 'Pauli Levokari')); height in centimeters refers to height_in_cm;
SELECT ( SELECT T2.height_in_cm FROM PlayerInfo AS T1 INNER JOIN height_info AS T2 ON T1.height = T2.height_id WHERE T1.PlayerName = 'David Bornhammar' ) - ( SELECT T2.height_in_cm FROM PlayerInfo AS T1 INNER JOIN height_info AS T2 ON T1.height = T2.height_id WHERE T1.PlayerName = 'Pauli Levokari' )
2,184
moderate
image_and_language
How many times is the number of images containing "broccoli" than "tomato"?
images refers to IMG_ID; "broccoli" refers to OBJ_CLASS = 'broccoli'; "tomato" refers to OBJ_CLASS = 'tomato' ; How many times = divide(count(OBJ_SAMPLE_ID) when OBJ_CLASS = 'broccoli', count(OBJ_SAMPLE_ID) when OBJ_CLASS = 'tomato')
SELECT CAST(COUNT(CASE WHEN T1.OBJ_CLASS = 'broccoli' THEN T2.OBJ_SAMPLE_ID ELSE NULL END) AS REAL) / COUNT(CASE WHEN T1.OBJ_CLASS = 'tomato' THEN T2.OBJ_SAMPLE_ID ELSE NULL END) times FROM OBJ_CLASSES AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID
5,308
challenging
image_and_language
What attributes are used to describe the wall on image no. 27.
What attributes refers to ATT_CLASS; wall on image no. 27 refers to OBJ_CLASS = 'wall' and IMG_ID = 27
SELECT T4.ATT_CLASS FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID INNER JOIN IMG_OBJ_ATT AS T3 ON T1.IMG_ID = T3.IMG_ID INNER JOIN ATT_CLASSES AS T4 ON T3.ATT_CLASS_ID = T4.ATT_CLASS_ID WHERE T2.OBJ_CLASS = 'wall' AND T1.IMG_ID = 27 GROUP BY T4.ATT_CLASS
3,657
moderate
image_and_language
What is the relationship between "feathers" and "onion" in image no.2345528?
relationship refers to PRED_CLASS; "feathers" and "onion" in image no.2345528 refers to IMG_ID = 2345528 and OBJ_CLASS = 'feathers' and OBJ_CLASS = 'onion'
SELECT T1.PRED_CLASS FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T2.OBJ1_SAMPLE_ID = T3.OBJ_SAMPLE_ID INNER JOIN OBJ_CLASSES AS T4 ON T3.OBJ_CLASS_ID = T4.OBJ_CLASS_ID WHERE (T4.OBJ_CLASS = 'feathers' OR T4.OBJ_CLASS = 'onion') AND T2.IMG_ID = 2345528 GROUP BY T1.PRED_CLASS
2,285
moderate
image_and_language
Name the object element that is described as being scattered on image no. 10.
Name the object element refers to OBJ_CLASS; scattered refers to ATT_CLASS = 'scattered'; image no. 10 refers to IMG_ID = 10
SELECT T2.OBJ_CLASS FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID INNER JOIN IMG_OBJ_ATT AS T3 ON T1.IMG_ID = T3.IMG_ID INNER JOIN ATT_CLASSES AS T4 ON T3.ATT_CLASS_ID = T4.ATT_CLASS_ID WHERE T4.ATT_CLASS = 'scattered' AND T1.IMG_ID = 10 GROUP BY T2.OBJ_CLASS
62
moderate
image_and_language
How many images have at least one pair of object samples with the relation "parked on"?
How many images have at least one pair of object samples with the relation "parked on" refers to count(IMG_ID) where OBJ1_SAMPLE_ID ! = OBJ2_SAMPLE_ID and PRED_CLASS = 'parked on'
SELECT SUM(CASE WHEN T1.PRED_CLASS = 'parked on' THEN 1 ELSE 0 END) FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T2.OBJ1_SAMPLE_ID != T2.OBJ2_SAMPLE_ID
1,568
moderate
image_and_language
On image no. 5, name the attributes that are composed of multiple objects.
image no. 5 refers to IMG_ID = 5; name the attributes refers to ATT_CLASS; multiple objects refers to count(ATT_CLASS) > = 2
SELECT T2.ATT_CLASS FROM IMG_OBJ_ATT AS T1 INNER JOIN ATT_CLASSES AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID WHERE T1.IMG_ID = 5 GROUP BY T2.ATT_CLASS HAVING COUNT(T2.ATT_CLASS) > 2
5,045
moderate
image_and_language
State the coordinate of X and Y for the object with the attribute of 'sparse' in image 1.
coordinates of X and Y for the object refer to X and Y coordinates of the bounding box; attribute of 'sparse' in image 1 refers to IMG_ID = 1 where ATT_CLASS = 'sparse';
SELECT T3.OBJ_SAMPLE_ID, T3.X, T3.Y FROM ATT_CLASSES AS T1 INNER JOIN IMG_OBJ_ATT AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T2.IMG_ID = T3.IMG_ID WHERE T3.IMG_ID = 1 AND T1.ATT_CLASS = 'sparse'
4,668
moderate
image_and_language
Give the object number of the sample which has the relationship of "lying on" with object sample no.1 from image no.2345524.
object number of the sample refers to OBJ1_SAMPLE_ID; object sample no.1 from image no.2345524 refers to OBJ2_SAMPLE_ID = 1 and IMG_ID = 2345524
SELECT T2.OBJ1_SAMPLE_ID FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T2.IMG_ID = 2345524 AND T1.PRED_CLASS = 'lying on' AND T2.OBJ2_SAMPLE_ID = 1
229
moderate
image_and_language
How many images have "picture" as their attribute class and "bear" as their object class?
"picture" as attribute class refers to ATT_CLASS = 'picture'; "bear" as object class refers to OBJ_CLASS = 'bear'; images refer to IMG_ID;
SELECT COUNT(T2.IMG_ID) FROM ATT_CLASSES AS T1 INNER JOIN IMG_OBJ_ATT AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T2.IMG_ID = T3.IMG_ID INNER JOIN OBJ_CLASSES AS T4 ON T3.OBJ_CLASS_ID = T4.OBJ_CLASS_ID WHERE T1.ATT_CLASS = 'picture' AND T4.OBJ_CLASS = 'bear'
3,526
moderate
image_and_language
What is the prediction class between object class 'chain' and 'label' in image 2360078?
prediction class refers to PRED_CLASS; object class 'chain' refers to OBJ_CLASS = 'chain'; object class 'label' refers to OBJ_CLASS = 'label'; image 2360078 refers to IMG_ID = 2360078;
SELECT DISTINCT T2.PRED_CLASS FROM IMG_REL AS T1 INNER JOIN PRED_CLASSES AS T2 ON T2.PRED_CLASS_ID = T1.PRED_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T1.IMG_ID = T3.IMG_ID AND T1.OBJ1_SAMPLE_ID = T3.OBJ_SAMPLE_ID INNER JOIN OBJ_CLASSES AS T4 ON T3.OBJ_CLASS_ID = T4.OBJ_CLASS_ID WHERE T1.IMG_ID = 2360078 AND T1.OBJ1_SAMPLE_ID = 15 OR T1.OBJ2_SAMPLE_ID = 18
1,615
moderate
image_and_language
What is the average difference in the y coordinate of 2 object samples with the relation "parked on" in image no.1?
relation "parked on" refers to PRED_CLASS = 'parked on'; image no.1 refers to IMG_ID = 1; average difference in the y coordinate = divide(sum(Y), count(PRED_CLASS)) where OBJ1_SAMPLE_ID ! = OBJ2_SAMPLE_ID
SELECT CAST(SUM(T3.Y) AS REAL) / COUNT(CASE WHEN T1.PRED_CLASS = 'parked on' THEN 1 ELSE NULL END) FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T2.OBJ1_SAMPLE_ID = T3.OBJ_CLASS_ID WHERE T2.IMG_ID = 1 AND T2.OBJ1_SAMPLE_ID != T2.OBJ2_SAMPLE_ID
3,706
challenging
image_and_language
On image no. 99 identify the percentage of objects that are described as white.
image no. 99 refers to IMG_ID = 99; described as white refers to ATT_CLASS = 'white'; percentage = divide(count(OBJ_SAMPLE_ID) where ATT_CLASS = 'white', count(OBJ_SAMPLE_ID)) as percentage
SELECT CAST(SUM(CASE WHEN T2.ATT_CLASS = 'white' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(OBJ_SAMPLE_ID) FROM IMG_OBJ_ATT AS T1 INNER JOIN ATT_CLASSES AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID WHERE T1.IMG_ID = 99
2,402
moderate
image_and_language
Based on image 5, what is the percentage of images that belong windows object class?
DIVIDE(COUNT(OBJ_SAMPLE_ID where OBJ_CLASS = 'windows' and IMG_ID = 5), COUNT(OBJ_SAMPLE_ID where IMG_ID = 5)) as percentage;
SELECT CAST(COUNT(T1.OBJ_SAMPLE_ID) AS REAL) * 100 / COUNT(CASE WHEN T1.IMG_ID = 5 THEN 1 ELSE 0 END) FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.OBJ_CLASS = 'windows'
2,210
moderate
image_and_language
What are the bounding boxes of the object samples with a predicted relation class of "by" in image no.1?
bounding boxes of the object samples refers to (x, y, W, H); predicted relation class of "by" refers to PRED_CLASS = 'by'; image no.1 refers to IMG_ID = 1
SELECT T3.X, T3.Y, T3.W, T3.H FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T2.OBJ1_SAMPLE_ID = T3.OBJ_CLASS_ID WHERE T2.IMG_ID = 1 AND T1.PRED_CLASS = 'by'
6,096
moderate
image_and_language
What is the object whose attribute is blurry in image no.2377993? Give the explanation about the object.
attribute is blurry refers to ATT_CLASS = 'blurry'; image no.2377993 refers to IMG_ID = 22377993; explanation about the object refers to OBJ_CLASS
SELECT T4.OBJ_CLASS_ID, T4.OBJ_CLASS FROM IMG_OBJ_att AS T1 INNER JOIN ATT_CLASSES AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T1.IMG_ID = T3.IMG_ID INNER JOIN OBJ_CLASSES AS T4 ON T3.OBJ_CLASS_ID = T4.OBJ_CLASS_ID WHERE T2.ATT_CLASS = 'blurry' AND T1.IMG_ID = 22377993
3,269
moderate
image_and_language
Please list the IDs of all the images with more than 2 pairs of object samples with the relation "parked on".
IDs of all the images refers to IMG_ID; relation "parked on" refers to PRED_CLASS = 'parked on'; more than 2 pairs refers to count(IMG_ID) where OBJ1_SAMPLE_ID ! = OBJ2_SAMPLE_ID
SELECT T2.IMG_ID FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T1.PRED_CLASS = 'parked on' AND T2.OBJ1_SAMPLE_ID != T2.OBJ2_SAMPLE_ID GROUP BY T2.IMG_ID HAVING COUNT(T2.IMG_ID) > 2
2,466
moderate
image_and_language
How many objects can you spot in image no. 72? What objects may be identified on the same image and within the bounding box represented as (341, 27, 42, 51)?
How many objects refers to OBJ_CLASS_ID; image no. 72 refers to IMG_ID = 72; What objects refers to OBJ_CLASS; bounding box represented as (341, 27, 42, 51) refers to X = 341 and Y = 27 and W = 42 and H = 51
SELECT SUM(IIF(T1.IMG_ID = 1, 1, 0)), SUM(IIF(T1.X = 341 AND T1.Y = 27 AND T1.W = 42 AND T1.H = 51, 1, 0)) FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID
1,404
challenging
image_and_language
Tell the attribute of the weeds in image no.2377988.
attribute of the weeds refers to OBJ_CLASS = 'weeds'; image no.2377988 refers to IMG_ID = 2377988
SELECT T2.ATT_CLASS FROM IMG_OBJ_att AS T1 INNER JOIN ATT_CLASSES AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T1.IMG_ID = T3.IMG_ID INNER JOIN OBJ_CLASSES AS T4 ON T3.OBJ_CLASS_ID = T4.OBJ_CLASS_ID WHERE T4.OBJ_CLASS = 'weeds' AND T1.IMG_ID = 2377988
5,866
moderate
image_and_language
Among the objects that have multiple relations, how many images whose captions for the prediction class ids are "on"?
objects that have multiple relations refers to OBJ1_SAMPLE_ID ! = OBJ2_SAMPLE_ID; captions for the prediction class ids are "on" refers to PRED_CLASS = 'on'
SELECT COUNT(T2.PRED_CLASS_ID) FROM IMG_REL AS T1 INNER JOIN PRED_CLASSES AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T1.OBJ1_SAMPLE_ID != T1.OBJ2_SAMPLE_ID AND T2.PRED_CLASS = 'on'
1,233
moderate
image_and_language
What are the width and height of the bounding box of the object with "keyboard" as their object class and (5, 647) as their coordinate?
The bounding box's W and H abbreviations stand for the object's width and height respectively; "keyboard" as object class refers to OBJ_CLASS = 'keyboard'; (5, 647) as coordinate refers to X and Y coordinates of the bounding box where X = 5 and Y = 647;
SELECT T1.W, T1.H FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.OBJ_CLASS = 'keyboard' AND T1.X = 5 AND T1.Y = 647
1,928
moderate
language_corpus
Indicate the page id of Wikipedia about Catalan language of all the pages that have a numeric value in their title.
the page id of Wikipedia refers to pid; numeric value contains only numbers, LIKE '%0%' OR '%1%' OR '%2%' OR '%3%' OR '%4%' OR '%5%' OR '%6%' OR '%7%' OR '%8%' OR '%9%';
SELECT pid, title FROM pages WHERE title LIKE '%0%' OR '%1%' OR '%2%' OR '%3%' OR '%4%' OR '%5%' OR '%6%' OR '%7%' OR '%8%' OR '%9%'
3,726
challenging
language_corpus
Which of these pages have more words, the page titled "Afluent" or "Asclepi"?
COUNT(words where title = 'Afluent')> COUNT(words where title = 'Asclepi')
SELECT CASE WHEN ( SELECT words FROM pages WHERE title = 'Asclepi' ) > ( SELECT words FROM pages WHERE title = 'Afluent' ) THEN 'Asclepi' ELSE 'Afluent' END
2,824
moderate
language_corpus
For corpus title "Atomium", pick 3 words appear in the title and calculate the total occurence of these words.
total occurrences refers to sum(occurrences)
SELECT T1.word, T1.occurrences FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid WHERE T2.pid = ( SELECT pid FROM pages WHERE title = 'Atomium' ) LIMIT 3
4,002
moderate
language_corpus
How many more times does the first word in the biwords pair "àbac-xinès" occur than the biwords pair itself?
àbac refers to word = 'àbac'; xinès refers to word = 'xinès'; How many more times the first word in the biwords occur than the biwords pair itself means SUBTRACT(words.occurrence, biwords.occurrences)
SELECT occurrences - ( SELECT occurrences FROM biwords WHERE w1st = ( SELECT wid FROM words WHERE word = 'àbac' ) AND w2nd = ( SELECT wid FROM words WHERE word = 'xinès' ) ) AS CALUS FROM words WHERE word = 'àbac'
771
moderate
language_corpus
How much higher in percentage does the word "grec" occur on the page titled "Àbac" than on the page titled "Astronomia"?
grec refers to word = 'grec'; Àbac refers to title = 'Àbac'; Astronomia refers to title = 'Astronomia'; percentage = DIVIDE(SUBTRACT(occurrences where title = 'Àbac' AND word = 'grec', occurrences where title = 'Astronomia' AND word = 'grec'), occurrences where title = 'Astronomia' AND word = 'grec')
SELECT CAST((SUM(CASE WHEN T3.title = 'Àbac' THEN T2.occurrences END) - SUM(CASE WHEN T3.title = 'Astronomia' THEN T2.occurrences END)) AS REAL) * 100 / SUM(CASE WHEN T3.title = 'Astronomia' THEN T2.occurrences END) FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid INNER JOIN pages AS T3 ON T2.pid = T3.pid WHERE T1.word = 'grec'
2,491
challenging
language_corpus
What percentage of Catalan-language Wikipedia pages have more than 10,000 words?
Catalan-language refers to lang = 'ca'; more than 10,000 words refer to words > 10000; DIVIDE(COUNT(pages WHERE words > 10000 and lang = 'ca'), COUNT(pages WHERE lang = 'ca')) as percentage;
SELECT CAST(COUNT(CASE WHEN T2.words > 10000 THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T2.page) FROM langs AS T1 INNER JOIN pages AS T2 ON T1.lid = T2.lid WHERE T1.lang = 'ca'
6,384
moderate
language_corpus
List down the words with word id from 1 to 10 and write down a paired word for each of them.
word id from 1 to 10 refers to wid BETWEEN 1 AND 10
SELECT T1.word AS W1, T3.word AS W2 FROM words AS T1 LEFT JOIN biwords AS T2 ON T1.wid = T2.w1st LEFT JOIN words AS T3 ON T3.wid = T2.w2nd WHERE T1.wid <= 10 GROUP BY T1.wid
2,419
moderate
language_corpus
What is the percentage of the words that have been repeated under 180 times in the Catalan language?
repeated under 180 times refers to occurrences < 180; Catalan language refers to lang = 'ca'; DIVIDE(COUNT(words WHERE occurrences < 180 and lang = 'ca'), COUNT(words WHERE lang = 'ca')) as percentage;
SELECT CAST(COUNT(CASE WHEN T2.occurrences < 180 THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.lid) FROM langs AS T1 INNER JOIN langs_words AS T2 ON T1.lid = T2.lid WHERE T1.lang = 'ca'
1,632
moderate
language_corpus
Indicate if there is any pair formed by the words fukunaga and d'egees.
Pair is a relationship of two words: w1st and w2nd, where w1st is word id of the first word and w2nd is a word id of the second word;  w1st = word = 'fukunaga' or w2nd = word = 'fukunaga'; w1st = word = 'd'egees'or w2nd = word = 'd'egees';
SELECT CASE WHEN COUNT(T1.wid) > 0 THEN 'yes' ELSE 'no' END FROM words AS T1 INNER JOIN biwords AS T2 ON T1.wid = T2.w1st OR T1.wid = T2.w2nd WHERE T2.w1st = ( SELECT wid FROM words WHERE T1.word = 'fukunaga' ) AND T2.w2nd = ( SELECT wid FROM words WHERE word LIKE 'd%egees' )
5,595
challenging
language_corpus
Which biwords pair has a higher occurrence, "àbac-xinès" or "àbac-grec"?
higher occurrence is MAX(occurrences); àbac refers to word = 'àbac'; xinès refers to word = 'xinès'; grec refers to word = 'grec'
SELECT CASE WHEN ( SELECT occurrences FROM biwords WHERE w1st = ( SELECT wid FROM words WHERE word = 'àbac' ) AND w2nd = ( SELECT wid FROM words WHERE word = 'xinès' ) ) > ( SELECT occurrences FROM biwords WHERE w1st = ( SELECT wid FROM words WHERE word = 'àbac' ) AND w2nd = ( SELECT wid FROM words WHERE word = 'grec' ) ) THEN 'àbac-xinès' ELSE 'àbac-grec' END AS CALUS FROM words LIMIT 1
1,453
challenging
language_corpus
What is the percentage of words in the Catalan language that have a repetition of more than 16,000 times?
words in the Catalan language refers lid = 1; repetition of more than 16,000 times refers to occurrences > 16000; DIVIDE(COUNT(words where lid = 1 and occurrences > 16000), COUNT(words where lid = 1)) as percentage;
SELECT CAST(COUNT(CASE WHEN occurrences > 16000 THEN lid ELSE NULL END) AS REAL) * 100 / COUNT(lid) FROM langs_words
583
moderate
language_corpus
How many times that the word pair of "barcelona" and "precolombina" occur?
Pair is a relationship of two words: w1st and w2nd, where w1st is word id of the first word and w2nd is a word id of the second word; w1st or w2nd = 'barcelona'; w1st or w2nd = 'precolombina';
SELECT SUM(occurrences) FROM biwords WHERE w1st = ( SELECT wid FROM words WHERE word = 'barcelona' ) AND w2nd = ( SELECT wid FROM words WHERE word = 'precolombina' )
3,048
moderate
language_corpus
In Abadia, what is the word id of the of the Catalan language that appeared the highest amount of times? Indicate the how many times did they said word id appeared.
Abadia refers to title = 'Abadia'; word id refers to wid; the highest amount of times refers to max(occurrences)
SELECT T2.wid, T2.occurrences FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid WHERE T1.title = 'Abadia' ORDER BY T2.occurrences DESC LIMIT 1
5,534
moderate
language_corpus
What are the total occurence of words that paired with "nombre"?
total occurrence refers to sum(occurrences); paired with "nombre" refers to w1st.word = "nombre" or w2nd.word = "nombre"
SELECT SUM(T2.occurrences) FROM words AS T1 INNER JOIN biwords AS T2 ON T1.wid = T2.w1st OR T1.wid = T2.w2nd WHERE T2.w1st IN (( SELECT wid FROM words WHERE word = 'nombre' ) OR T2.w2nd IN ( SELECT wid FROM words WHERE word = 'nombre' ))
1,951
moderate
law_episode
Give me the years and episode IDs in which Constantine Makris was the winner of the Television Silver Gavel Award at the American Bar Association Silver Gavel Awards for Media and the Arts for two consecutive years.
the winner refers to result = 'Winner'; the Television refers to award = 'Television'; Silver Gavel Award refers to award_category = 'Silver Gavel Award'; the American Bar Association Silver Gavel Awards for Media and the Arts refers to organization = 'American Bar Association Silver Gavel Awards for Media and the Arts'
SELECT t3.years, t3.episode_id FROM ( SELECT DISTINCT T2.year AS years, T2.episode_id, row_number() OVER (PARTITION BY T2.episode_id ORDER BY T2.year) AS rm FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T2.award = 'Television' AND T2.award_category = 'Silver Gavel Award' AND T1.name = 'Constantine Makris' AND T2.result = 'Winner' AND T2.organization = 'American Bar Association Silver Gavel Awards for Media and the Arts' ) AS T3 GROUP BY t3.episode_id HAVING COUNT(t3.years - t3.rm) >= 2
4,138
challenging
law_episode
How many times was episode 20 of the Law and Order series nominated for the Primetime Emmy Awards in 1999?
nominated refers to result = 'nominee'; the Law and Order series refers to series = 'Law and Order'; the Primetime Emmy Awards refers to organization = 'Primetime Emmy Awards'; in 1999 refers to year = 1999
SELECT COUNT(T2.award_id) FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE T2.year = 1999 AND T2.result = 'Nominee' AND T1.episode = 20 AND T2.organization = 'Primetime Emmy Awards' AND T1.series = 'Law and Order'
5,168
moderate
law_episode
Which episode number has the second highest positive viewer comments and has been awarded "Best Television Episode"?
episode number refers to episode_id; awarded "Best Television Episode" refers to award = 'Best Television Episode' and result = 'Winner'; the second highest positive viewer comments refers to rating = 8.5
SELECT T2.episode_id FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.award = 'Best Television Episode' AND T1.result = 'Winner' ORDER BY T2.rating DESC LIMIT 2
190
moderate
law_episode
What is the average star rating of the episodes Jim Bracchitta has worked on?
average star rating = divide(sum(stars), count(episode_id)) where name = 'Jim Bracchitta'
SELECT CAST(SUM(T3.stars) AS REAL) / COUNT(T2.episode_id) FROM Person AS T1 INNER JOIN Credit AS T2 ON T1.person_id = T2.person_id INNER JOIN Vote AS T3 ON T2.episode_id = T3.episode_id WHERE T3.stars = 1 AND T1.name = 'Jim Bracchitta'
3,008
moderate
law_episode
Among the American casts, how many were uncredited on episode ID tt0629228?
American refers to birth_country = 'USA'; cast refers to category = 'Cast'; uncredited refers to credited = ''
SELECT COUNT(T1.person_id) FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T1.episode_id = 'tt0629228' AND T1.category = 'Cast' AND T1.credited = 'false' AND T2.birth_country = 'USA'
5,552
moderate
law_episode
What is the ratio of American casts on episode 2 of the series? Please include their roles.
American refers to birth_country = 'USA'; cast refers to category = 'Cast'; ratio = divide(count(person_id where birth_country = 'USA'), total(category)) where category = 'Cast'
SELECT CAST(SUM(CASE WHEN T2.category = 'Cast' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.category), T1.role FROM Award AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Episode AS T3 ON T2.episode_id = T3.episode_id INNER JOIN Person AS T4 ON T2.person_id = T4.person_id WHERE T3.episode = 2 AND T4.birth_country = 'USA'
6,502
challenging
law_episode
Who was the Law and Order series writer who also won the Television Silver Gavel Award at the American Bar Association Silver Gavel Awards for Media and the Arts for two consecutive years?
who refers to name; writer refers to role = 'writer'; won refers to result = 'Winner'; the Television refers to award = 'Television'; Silver Gavel Award refers to award_category = 'Silver Gavel Award'; the American Bar Association Silver Gavel Awards for Media and the Arts refers to organization = 'American Bar Association Silver Gavel Awards for Media and the Arts'
SELECT t3.name FROM ( SELECT DISTINCT T2.year AS years, T1.name, row_number() OVER (PARTITION BY T1.name ORDER BY T2.year) AS rm FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T2.award = 'Television' AND T2.award_category = 'Silver Gavel Award' AND T2.series = 'Law and Order' AND T2.result = 'Winner' AND T2.organization = 'American Bar Association Silver Gavel Awards for Media and the Arts' ) AS T3 GROUP BY t3.name HAVING COUNT(t3.years - t3.rm) >= 2
641
challenging
law_episode
Park Dietz was credited in which role in the episode titled "Cherished"?
credited refers to credited = 'true'; titled "Cherished" refers to title = 'Cherished'
SELECT T2.role FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T1.title = 'Cherished' AND T3.name = 'Park Dietz' AND T2.credited = 'true'
5,262
moderate
law_episode
What are the titles of the top 3 episodes that received no less than 30 votes in its 10-star rating?
no less than 30 votes refers to votes > = 30; 10-star rating refers to stars = 10
SELECT T2.title FROM Vote AS T1 INNER JOIN Episode AS T2 ON T2.episode_id = T1.episode_id WHERE T1.votes >= 30 AND T1.stars = 10 ORDER BY T1.votes DESC LIMIT 3
1,120
moderate
law_episode
Among the episodes that were aired in 1998, how many won an International Monitor Awards?
aired in 1998 refers to air_date like '1998%'; won refers to result = 'Winner'; International Monitor Awards refers to organization = 'International Monitor Awards'
SELECT COUNT(T1.episode_id) FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE strftime('%Y', T1.air_date) = '1998' AND T2.organization = 'International Monitor Awards' AND T2.result = 'Winner'
3,123
moderate
law_episode
List the titles and air dates of episodes that were produced by Billy Fox.
produced refers to role = 'producer'
SELECT T1.title, T1.air_date FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T2.category = 'Produced by' AND T2.role = 'producer' AND T3.name = 'Billy Fox'
4,431
moderate
law_episode
Who was the nominee playing the role of Katrina Ludlow in the Law & Order series?
nominee refers to result = 'Nominee'; the role of Katrina Ludlow refers to role = 'Katrina Ludlow'
SELECT T2.name FROM Award AS T1 INNER JOIN Person AS T2 ON T1.person_id = T2.person_id WHERE T1.result = 'Nominee' AND T1.role = 'Katrina Ludlow' AND T1.series = 'Law and Order'
1,032
moderate
law_episode
On what episode did Julia Roberts win the "Outstanding Guest Actress in a Drama Series" award during the 1999 Primetime Emmy Awards? Tell me her role.
win refers to result = 'Winner'; the "Outstanding Guest Actress in a Drama Series" award refers to award = 'Outstanding Guest Actress in a Drama Series'; the 1999 refers to year = 1999; Primetime Emmy Awards refers to organization = 'Primetime Emmy Awards'
SELECT T3.episode_id, T2.role FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id INNER JOIN Episode AS T3 ON T2.episode_id = T3.episode_id WHERE T2.year = 1999 AND T2.award = 'Outstanding Guest Actress in a Drama Series' AND T2.organization = 'Primetime Emmy Awards' AND T1.name = 'Julia Roberts' AND T2.result = 'Nominee'
6,530
challenging
law_episode
For season 9, episode 17 of the show Law and Order, how many roles have been included in the credit?
Law and Order refers to series = 'Law and Order'; included in the credit refers to credited = 'true'
SELECT COUNT(T2.role) FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T1.series = 'Law and Order' AND T1.season = 9 AND T1.episode = 17 AND T2.credited = 'true'
1,987
moderate
law_episode
What is the percentage of people who gave the "True North" episode a 1-star rating?
the "True North" episode refers to title = 'True North'; 1-star refers to stars = 1; percentage = divide(count(episode_id where stars = 1), count(episode_id)) * 100% where title = 'True North'
SELECT CAST(SUM(CASE WHEN T2.stars = 1 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.episode_id) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'True North' AND T1.episode_id = 'tt0629477'
3,506
moderate
law_episode
List out director names that received an award along with the episode number.
director refers to role = 'director'; received an award refers to result = 'Winner'; episode number refers to episode
SELECT T3.name, T1.episode_id FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T2.person_id = T3.person_id WHERE T2.role = 'director' AND T2.result = 'Winner'
4,388
moderate
law_episode
What are the keywords of the episode which received the 2nd-highest number of votes?
the 2nd-highest number of votes refers to second max(votes)
SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.votes NOT IN ( SELECT MAX(T1.votes) FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id ) ORDER BY T1.votes DESC LIMIT 1
6,313
moderate
law_episode
Please list the titles of all the episodes in which Park Dietz was credited.
credited refers to credited = 'true'
SELECT T1.title FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T2.credited = 'true' AND T3.name = 'Park Dietz'
4,122
moderate
law_episode
Who is the person who appeared the most in the series? Calculate in percentage how many times he or she appeared.
who refers to name; appear the most refers to max(count(person_id)); percentage = divide(count(person_id where max(count(person_id))), count(person_id)) * 100%
SELECT T2.person_id, CAST(COUNT(T2.person_id) AS REAL) * 100 / ( SELECT COUNT(T2.person_id) AS num FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id ) AS per FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id GROUP BY T2.person_id ORDER BY COUNT(T2.person_id) DESC LIMIT 1
6,318
moderate
law_episode
How many times is the number of keywords in "Refuge: Part 1" episode than "Shield" episode?
"Refuge: Part 1" episode refers to title = 'Refuge: Part 1'; "Shield" episode refers to title = 'Shield'; times = divide(count(keyword where title = 'Refuge: Part 1'), count(keyword where title = 'Shield'))
SELECT CAST(SUM(CASE WHEN T1.title = 'Refuge: Part 1' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN T1.title = 'Shield' THEN 1 ELSE 0 END) FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id
3,566
moderate
law_episode
Who is the winner of the Best Television Episode award for the Edgar category in 2000? Include his or her name and role.
the Best Television Episode award refers to award = 'Best Television Episode'; the Edgar category refers to award_category = 'Edgar'; in 2000 refers to year = 2000
SELECT T1.name, T2.role FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T2.year = 2000 AND T2.award_category = 'Edgar' AND T2.award = 'Best Television Episode'
914
moderate
legislator
Who is the Pro-Administration senator that runs from March 4, 1789 to December 31, 1791?
Pro-Administration refers to party = 'Pro-Administration'; senator refers to type = 'sen'; runs from March 4, 1789 refers to start = '1789-03-04'; runs to refers to end = '1791-12-31';
SELECT T1.first_name, T1.last_name FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.party = 'Pro-Administration' AND T2.start = '1789-03-04' AND T2.end = '1791-12-31'
865
moderate
legislator
Give the religion of the legislator with RSS url of http://www.corker.senate.gov/public/index.cfm/rss/feed.
religion refers to religion_bio;
SELECT T1.religion_bio FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.rss_url = 'http://www.corker.senate.gov/public/index.cfm/rss/feed' GROUP BY T1.religion_bio
4,526
moderate
legislator
Provide the start date, end date, and party of Pearl Peden Oldfield.
start date refers to start; end date refers to end date; Pearl Peden Oldfield refers to official_full_name; official_full_name refers to first_name, middle_name, last_name
SELECT T2.start, T2.`end`, T2.party FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.first_name = 'Pearl' AND T1.middle_name = 'Peden' AND T1.last_name = 'Oldfield'
1,604
moderate
legislator
List the official full names of all the legislators that served 13 district for 26 consecutive years.
served only one district for 26 consecutive years refers to SUBTRACT(SUM(cast(strftime('%Y', end)), CAST(strftime('%Y', start)))) = 26
SELECT DISTINCT CASE WHEN SUM(CAST(strftime('%Y', T2.end) AS int) - CAST(strftime('%Y', T2.start) AS int)) = 26 THEN T1.official_full_name END FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide GROUP BY T1.official_full_name, T2.district HAVING COUNT(T1.official_full_name) = 13
4,400
challenging
legislator
Among the current legislators who do not have accounts on OpenSecrets.org., how many of them do not have instagram accounts either?
do not have accounts on OpenSecrets.org refers to opensecrets_ID is NULL OR opensecrets_id = ''; do not have instagram accounts refers to instagram is null
SELECT SUM(CASE WHEN T1.instagram IS NULL THEN 1 ELSE 0 END) AS count FROM `social-media` AS T1 INNER JOIN current AS T2 ON T1.bioguide = T2.bioguide_id WHERE T2.opensecrets_id IS NULL OR T2.opensecrets_id = ''
1,480
moderate
legislator
Among the current legislators who have served for more than 6 terms, how many of them were born after 1960?
served for more than 6 terms refers to COUNT(bioguide > 6); born after 1960 refers to birthday_bio > = '1960-01-01'
SELECT COUNT(CID) FROM ( SELECT T1.bioguide_id AS CID FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.birthday_bio >= '1960-01-01' GROUP BY T2.bioguide HAVING COUNT(T2.bioguide) > 6 )
4,736
moderate
legislator
Among the female legislators, what is the percentage of the senators in Maine?
female refers to gender_bio = 'F'; percentage = MULTIPLY(DIVIDE(SUM(type = 'sen'), COUNT(type)), 100.0); senators refers to type = 'sen'; Maine refers to state = 'ME';
SELECT CAST(SUM(CASE WHEN T2.type = 'sen' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.type) FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.state = 'ME' AND T1.gender_bio = 'F'
176
moderate
legislator
How many Federalist representatives are there whose first names are Benjamin?
Federalist refers to party = 'Federalist'; representatives refers to type = 'rep';
SELECT COUNT(T.bioguide_id) FROM ( SELECT T1.bioguide_id FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.first_name = 'Benjamin' AND T2.party = 'Federalist' AND T2.type = 'rep' GROUP BY T1.bioguide_id ) AS T
4,875
moderate
legislator
Among the current legislators who served the term starting on 2013/1/3, how many of them are female?
term starting on 2013/1/3 refers to start = '2013-01-03; female refers to gender_bio = 'F';
SELECT COUNT(*) FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.start = '2013-01-03' AND T1.gender_bio = 'F'
6,274
moderate
legislator
Among the male legislators born between 1955 to 1965, what is the percentage of the legislators with an independent party?
male refers to gender_bio = 'M'; born between 1955 to 1965 refers to strftime('%Y', birthday_bio) between '1955' and '1965'; percentage = MULTIPLY(DIVIDE(SUM(party = 'Independent' WHERE gender_bio = 'M' AND strftime('%Y', birthday_bio) between '1955' and '1965'), COUNT(party WHERE gender_bio = 'M' AND strftime('%Y', birthday_bio) between '1955' and '1965')), 100.0);
SELECT CAST(SUM(CASE WHEN T2.party = 'Independent' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.party) FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.gender_bio = 'M' AND strftime('%Y', T1.birthday_bio) BETWEEN '1955' AND '1965'
3,215
challenging
legislator
Among the current legislators who have accounts on both http://thomas.gov, how many of them have accounts on instagram?
have accounts on both http://thomas.gov refers to thomas_id is NOT null; have accounts on instagram refers to instagram is not null;
SELECT COUNT(DISTINCT T1.bioguide_id) FROM current AS T1 INNER JOIN `social-media` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.thomas_id IS NOT NULL AND T2.instagram IS NOT NULL
3,154
moderate
legislator
Among all the female current legislators, how many of them have served for more than 4 terms?
female refers to gender_bio = 'F'; served for more than 4 terms refers to COUNT(bioguide > 4)
SELECT COUNT(CID) FROM ( SELECT T1.bioguide_id AS CID FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.gender_bio = 'F' GROUP BY T2.bioguide HAVING COUNT(T2.bioguide) > 4 )
2,215
moderate
legislator
Among all the current legislators whose religion is Roman Catholic, what is the percentage of the ones without an instagram account?
religion is Roman Catholic refers to religion_bio = 'Roman Catholic'; calculation = MULTIPLY(DIVIDE(COUNT(instagram is null), COUNT(bioguide_id)), 1.0)
SELECT CAST(SUM(CASE WHEN T1.instagram IS NULL THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM `social-media` AS T1 INNER JOIN current AS T2 ON T1.bioguide = T2.bioguide_id WHERE T2.religion_bio = 'Roman Catholic'
2,541
moderate
legislator
Based on the number of current legislators, calculate the percentage of legislators that served in 21st-Century.
percentage = MULTIPLY(DIVIDE(SUM(strftime('%Y', start) between '2000' and '2017'), COUNT(bioguide_id)), 100.0); 1st-Century refers to strftime('%Y', T2.start) between '2000' and '2017';
SELECT CAST(SUM(CASE WHEN strftime('%Y', T2.start) BETWEEN '2000' AND '2017' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.bioguide_id) FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide
3,149
moderate
legislator
List down the district number of the representative of the house named Jonathan Grout.
district number refers to district; representative of the house refers to type = 'rep';
SELECT T2.district FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.last_name = 'Grout' AND T1.first_name = 'Jonathan' AND T2.type = 'rep'
1,727
moderate
legislator
List the full name of all past legislators that chose Pro-Administration as their political party in year 1791.
full name refers to official_full_name; chose Pro-Administration as their political party refers to party = 'Pro-Administration'; 1791 refers to start < = 1791 AND END > = 1791
SELECT T1.first_name, T1.last_name FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.party = 'Pro-Administration' AND CAST(T2.start AS DATE) <= 1791 AND CAST(T2.END AS DATE) >= 1791
3,634
moderate
legislator
Current legislator Roger F. Wicker has not been a representative for how many terms?
Roger F. Wicker is an official_full_name; not a representative refers to district IS NULL OR district = ''
SELECT SUM(CASE WHEN T1.official_full_name = 'Roger F. Wicker' THEN 1 ELSE 0 END) AS count FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.district IS NULL OR T2.district = ''
4,451
moderate
legislator
Who is the Lutheran representative that served in the state of Ohio for 14 years before becoming a senator?
Lutheran refers to religion_bio = 'Lutheran'; representative refers to type = 'rep'; served for 14 years refers to SUBTRACT(SUM(CAST(strftime('%Y', end)), CAST(strftime('%Y', start)))) = 14;
SELECT CASE WHEN SUM(CAST(strftime('%Y', T2.end) AS int) - CAST(strftime('%Y', T2.start) AS int)) = 14 THEN official_full_name END FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.religion_bio = 'Lutheran' AND T2.state = 'OH' AND T2.type = 'rep'
1,015
challenging
legislator
Among the Independent senators that started their term in 2011 and onwards, what are the official full names of the senators that caucused with the Democrat?
Independent refers to party = 'Independent'; senators refers to type = 'sen'; started the term in 2011 and onwards refers to strftime('%Y', start) > = '2011'; caucused with the Democrat refers to caucus = 'Democrat';
SELECT T1.official_full_name FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.party = 'Independent' AND strftime('%Y', T2.start) >= '2011' AND T2.type = 'sen' AND T2.caucus = 'Democrat'
299
moderate
legislator
Which current legislator has served for more terms, Sherrod Brown or Maria Cantwell?
if sum(official_full_name = 'Maria Cantwell') > sum(official_full_name = 'Sherrod Brown') then Maria Cantwell has served for more term than Sherrod Brown; if sum(official_full_name = 'Sherrod Brown') > sum(official_full_name = 'Maria Cantwell'), then Sherrod Brown has served for more terms than Maria Cantwell;
SELECT CASE WHEN SUM(CASE WHEN T1.official_full_name = 'Maria Cantwell' THEN 1 ELSE 0 END) > SUM(CASE WHEN T1.official_full_name = 'Sherrod Brown' THEN 1 ELSE 0 END) THEN 'Maria Cantwell' ELSE 'Sherrod Brown' END FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide
1,711
challenging
legislator
Among all the current legislators who have served for more than 4 terms, what is the percentage of them being female?
have served for more than 4 years refers to count(bioguide) > 4; percentage = MULTIPLY(DIVIDE(SUM(gender_bio = 'F'), count(bioguide)), 100.0); female refers to gender_bio = 'F'
SELECT CAST(SUM(CASE WHEN gender_bio = 'F' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T3.bioguide) FROM ( SELECT T2.bioguide, T1.gender_bio FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide GROUP BY T2.bioguide HAVING COUNT(T2.bioguide) > 4 ) T3
1,803
challenging
legislator
Calculate the average number of current male legislators who chose Democrat from 2000 until 2021.
male refers to gender_bio = 'M'; legislators who chose Democrat refers to party = 'Democrat'; from 2000 until 2021 refers to start > = 2000 AND END < = 2021; calculation = DIVIDE(COUNT(bioguide_id), 22)
SELECT CAST(COUNT(T1.bioguide_id) AS REAL) / 22 FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.gender_bio = 'M' AND CAST(T2.start AS DATE) >= 2000 AND CAST(T2.END AS DATE) <= 2021 AND T2.party = 'Democrat'
5,358
moderate
legislator
What is the full official name of the current legislator that has served for the most number of terms?
served for the most number of terms refers to MAX(COUNT(bioguide));
SELECT T1.official_full_name FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide GROUP BY T1.official_full_name, T2.bioguide ORDER BY COUNT(T2.bioguide) DESC LIMIT 1
936
moderate
legislator
Provide the full name of all current female legislators that chose Republican as their political party.
full name refers to official_full_name; official_full_name refers to first_name, last_name; female refers to gender_bio = 'F'; chose Republican as their political party refers to party = 'Republican'; current legislators refers to END > Date()
SELECT T1.first_name, T1.last_name FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.party = 'Republican' AND T1.gender_bio = 'F' AND T2.END > DATE() GROUP BY T1.bioguide_id
2,331
moderate
mental_health_survey
What is the rate of increase of users with a current mental disorder from 2019's survey to 2016's survey?
rate of increase = subtract(divide(count(SurveyID = 2019& QuestionID = 33& AnswerText = 'Yes'), count(SurveyID = 2019& QuestionID = 33)), divide(count(SurveyID = 2016& QuestionID = 33& AnswerText = 'Yes'), count(SurveyID = 2016& QuestionID = 33)))
SELECT CAST(( SELECT COUNT(T2.UserID) FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T2.SurveyID = 2019 AND T1.questiontext LIKE 'Do you currently have a mental health disorder?' AND T2.AnswerText = 'Yes' ) - ( SELECT COUNT(T2.UserID) FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T2.SurveyID = 2016 AND T1.questiontext LIKE 'Do you currently have a mental health disorder?' AND T2.AnswerText = 'Yes' ) AS REAL) * 100 / ( SELECT COUNT(T2.UserID) FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T2.SurveyID = 2016 AND T1.questiontext LIKE 'Do you currently have a mental health disorder?' AND T2.AnswerText = 'Yes' )
5,903
challenging
mental_health_survey
Betweeen 2016 to 2019, which year recorded the highest number of people with mental illness?
Between 2016 to 2019 refer to SurveyID 2016 BETWEEN 2019; People with mental illness refers to AnswerText = 'Yes' where questionid = 34
SELECT T1.SurveyID FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T1.SurveyID BETWEEN 2016 AND 2019 AND T2.questionid = 34 AND T1.AnswerText LIKE 'Yes' GROUP BY T1.SurveyID ORDER BY COUNT(T1.UserID) DESC LIMIT 1
1,900
moderate
mental_health_survey
Among respondents who participated in the survey in 2016, what percentage had a mental health disorder in the past?
respondents and 'users' are synonyms; percentage = divide(count(SurveyID = 2016& QuestionID = 32 & AnswerText = 'Yes'), count(SurveyID = 2016& QuestionID = 32))*100%
SELECT CAST(SUM(CASE WHEN T1.AnswerText LIKE 'Yes' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.SurveyID) FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T1.QuestionID = 32 AND T1.SurveyID = 2016
4,303
challenging
mental_health_survey
How many times more for the number of users who took the "mental health survey for 2017" than "mental health survey for 2018"?
How many times more = subtract(count(UserID(SurveyID = 2017)), count(UserID(SurveyID = 2018)))
SELECT CAST(COUNT(T1.UserID) AS REAL) / ( SELECT COUNT(T1.UserID) FROM Answer AS T1 INNER JOIN Survey AS T2 ON T1.SurveyID = T2.SurveyID WHERE T2.Description = 'mental health survey for 2018' ) FROM Answer AS T1 INNER JOIN Survey AS T2 ON T1.SurveyID = T2.SurveyID WHERE T2.Description = 'mental health survey for 2017'
3,322
challenging
mental_health_survey
What is the percentage of the the users who would bring up a mental health issue with a potential employer in an interview?
Percentage = DIVIDE(SUM(AnswerText = 'Yes' Or AnswerText = 'Maybe'), COUNT(QuestionID = 12))* 100
SELECT CAST(SUM(CASE WHEN T1.AnswerText LIKE 'Yes' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.UserID) FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questionid = 12
563
challenging
mental_health_survey
How many female users were surveyed in the mental health survey for 2017 in the state of Nebraska?
AnswerText = 'Yes' where questiontext = 'Do you have a family history of mental illness?'; AnswerText = 'Female' where questionid = 2; AnswerText = 'Nebraska' where questionid = 4
SELECT COUNT(*) FROM ( SELECT T2.UserID FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID INNER JOIN Survey AS T3 ON T2.SurveyID = T3.SurveyID WHERE T3.Description = 'mental health survey for 2017' AND T1.questionid = 2 AND T2.AnswerText = 'Female' UNION SELECT T2.UserID FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID INNER JOIN Survey AS T3 ON T2.SurveyID = T3.SurveyID WHERE T1.questionid = 4 AND T2.AnswerText = 'Nebraska' AND T3.Description = 'mental health survey for 2017' )
4,757
challenging
mental_health_survey
How many respondents who participated in the survey in 2019 have ever sought treatment for a mental health disorder from a mental health professional?
respondents' and 'users' are synonyms, have ever sought treatment for a mental health disorder from a mental health professional refers to AnswerText(SurveyID = 2019& QuestionID = 7) = 1
SELECT COUNT(T1.UserID) FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T1.QuestionID = 7 AND T1.SurveyID = 2019 AND T1.AnswerText = 1
2,227
moderate
mental_health_survey
In 2019, how many users in the United States have a family history of mental illness?
2019 refer to SurveyID; Users in the United States refers to AnswerText = 'United States' where questionid = 3; have a family history of mental illness refers to AnswerText = 'Yes' where questionid = 6
SELECT COUNT(T1.UserID) FROM Answer AS T1 INNER JOIN ( SELECT T2.questionid FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T1.SurveyID = 2019 AND T2.questionid = 6 AND T1.AnswerText LIKE 'Yes' ) AS T2 ON T1.QuestionID = T2.questionid WHERE T1.SurveyID = 2019 AND T2.questionid = 3 AND T1.AnswerText LIKE 'United States'
4,181
challenging
mental_health_survey
How many users answered "No" to the question "Would you bring up a mental health issue with a potential employer in an interview?" in 2014's survey?
2014 refer to SurveyID; Answered No refer to AnswerText = 'No'; Question refer to questiontext
SELECT COUNT(T2.UserID) FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T1.questiontext = 'Would you bring up a mental health issue with a potential employer in an interview?' AND T2.SurveyID = 2014 AND T2.AnswerText LIKE 'NO'
489
moderate
mental_health_survey
What was the percentage for the answer of "Yes" was given to the question "Has your employer ever formally discussed mental health (for example, as part of a wellness campaign or other official communication)?"?
percentage = divide(count(QuestionID = 15& AnswerText = 'Yes'), count(QuestionID = 15))*100%
SELECT CAST(SUM(CASE WHEN T1.AnswerText LIKE 'Yes' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.UserID) FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questiontext LIKE 'Has your employer ever formally discussed mental health (for example, as part of a wellness campaign or other official communication)?'
2,133
challenging
mental_health_survey
What is the average age of the survey respondents in the United States?
Average age refer to AVG(AnswerText) where questionid = 1; respondents in the United States refers to AnswerText = 'United States' where questionid = 3
SELECT CAST(SUM(T1.AnswerText) AS REAL) / COUNT(T1.UserID) FROM Answer AS T1 INNER JOIN ( SELECT T1.UserID FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questionid = 3 AND T1.AnswerText = 'United States' ) AS T2 ON T1.UserID = T2.UserID INNER JOIN Question AS T3 ON T1.QuestionID = T3.questionid WHERE T3.questionid = 1
2,290
challenging
mental_health_survey
How many different answers did the question "Describe the conversation you had with your previous employer about your mental health, including their reactions and actions taken to address your mental health issue/questions." get?
SELECT COUNT(DISTINCT T1.AnswerText) FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questiontext LIKE 'Describe the conversation you had with your previous employer about your mental health, including their reactions and actions taken to address your mental health issue/questions.'
3,930
moderate
menu
List the dishes that appeared at the left upper corner of the CHAS.BRADLEY'S OYSTER & DINING ROOM"s sponsored menu.
appeared at the left upper corner refers to xpos < 0.25 and ypos < 0.25; CHAS.BRADLEY'S OYSTER & DINING ROOM refers to sponsor = 'CHAS.BRADLEY''S OYSTER & DINING ROOM';
SELECT T4.name FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id INNER JOIN Dish AS T4 ON T1.dish_id = T4.id WHERE T3.sponsor = 'CHAS.BRADLEY''S OYSTER & DINING ROOM' AND T1.xpos < 0.25 AND T1.ypos < 0.25
6,204
moderate
menu
On the menu with the most dishes, how many dishes were there on its second page?
menu with the most dishes refers to menu.id with MAX(dish_count); second page refers to page_number = 2;
SELECT COUNT(T1.dish_id) FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id WHERE T2.page_number = 2 GROUP BY T3.name ORDER BY T3.dish_count DESC LIMIT 1
236
moderate
menu
Which dish has the highest price on the menu "Zentral Theater Terrace"? Please give its name.
highest price refers to MAX(Price); Zentral Theater Terrace is a name of menu;
SELECT T4.name FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id INNER JOIN Dish AS T4 ON T1.dish_id = T4.id WHERE T3.name = 'Zentral Theater Terrace' ORDER BY T1.price DESC LIMIT 1
5,499
moderate
menu
Is "c02c9a3b-6881-7080-e040-e00a180631aa" the uuid for menu called "The Biltmore"?
if 'c02c9a3b-6881-7080-e040-e00a180631aa' can be found in uuid, it means the 'c02c9a3b-6881-7080-e040-e00a180631aa' is the uuid for the menu called The Biltmore; if 'c02c9a3b-6881-7080-e040-e00a180631aa' can not be found in uuid, it means the 'c02c9a3b-6881-7080-e040-e00a180631aa' is not the uuid for the menu called The Biltmore; The Biltmore is a name of menu;
SELECT CASE WHEN T2.uuid = 'c02c9a3b-6881-7080-e040-e00a180631aa' THEN 'yes' ELSE 'no' END AS yn FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id WHERE T1.name = 'The Biltmore' AND T2.uuid = 'c02c9a3b-6881-7080-e040-e00a180631aa'
4,716
moderate
menu
Among the dishes, how many of them were created between 2011-03-31 at 20:24:46 UTC and 2011-04-15 at 23:09:51 UTC.
created between 2011-03-31 at 20:24:46 UTC and 2011-04-15 at 23:09:51 UTC refers to created_at between '2011-03-31 20:24:46 UTC' AND '2011-04-15 23:09:51 UTC';
SELECT SUM(CASE WHEN T2.created_at BETWEEN '2011-03-31 20:24:46 UTC' AND '2011-04-15 23:09:51 UTC' THEN 1 ELSE 0 END) FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id
6,170
moderate
menu
Among the menus in which the dish "Clear green turtle" had appeared, how many of them did not support taking out or booking in advance?
Clear green turtle is a name of dish; not support taking out or booking in advance refers to call_number is null;
SELECT SUM(CASE WHEN T4.name = 'Clear green turtle' THEN 1 ELSE 0 END) FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id INNER JOIN Dish AS T4 ON T1.dish_id = T4.id WHERE T3.call_number IS NULL
1,752
challenging
menu
Among the dishes on menu page ID 7610, list the names and highest prices of the dishes in menu items that were created on 23rd May 2011.
highest prices of the dishes refers to MAX(price); created on 23rd May 2011 refers to created_at like '2011-05-23%';
SELECT T1.name, T2.price FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T2.created_at LIKE '2011-05-23%' ORDER BY T2.price DESC LIMIT 1
1,660
moderate