Chinastark/bird_dataset huggingface dataset:
Database: mental_health_survey
Note: answertext = 'Yes' where questiontext = 'Do you have a family history of mental illness?'; answertext = 'Female' where questionid = 2; answertext = 'Nebraska' where questionid = 4;
Question: How many female users were surveyed in the mental health survey for 2017 in the state of Nebraska?
SQL: SELECT count(*) FROM ( SELECT answer.userid FROM question INNER JOIN answer ON question.questionid = answer.questionid INNER JOIN survey ON answer.surveyid = survey.surveyid WHERE survey.description = 'mental health survey for 2017' AND question.questionid = 2 AND answer.answertext = 'Female' UNION SELECT answer.userid FROM question INNER JOIN answer ON question.questionid = answer.questionid INNER JOIN survey ON answer.surveyid = survey.surveyid WHERE question.questionid = 4 AND answer.answertext = 'Nebraska' AND survey.description = 'mental health survey for 2017' )
Database: mental_health_survey
Note: Users who believed that their productivity is affected by a mental health issues overall refers to answertext = 'Yes' where questionid = 54;
Question: How many users believed that their productivity is ever affected by a mental health issue overall?
SQL: SELECT count(answer.userid) FROM answer INNER JOIN question ON answer.questionid = question.questionid WHERE question.questionid = 54 AND answer.answertext LIKE 'Yes'
Database: mental_health_survey
Note: Oldest user refer to MAX(answertext) where questionid = 1; Youngest user refer to MIN(answertext) where questionid = 1;
Question: What are the ages of the oldest and youngest user that were surveyed? Indicate their user id.
SQL: SELECT max(answer.answertext), min(answer.answertext) , ( SELECT answer.userid FROM answer INNER JOIN question ON answer.questionid = question.questionid WHERE question.questionid = 1 ORDER BY answer.answertext LIMIT 1 ) AS "youngest id" FROM answer INNER JOIN question ON answer.questionid = question.questionid WHERE question.questionid = 1
Database: mental_health_survey
Note: Country with least number of users being surveyed refers to MIN(COUNT(answertext)) where questionid = 3;
Question: Which country have the least number of users being surveyed? Indicate the name of the country. If there are multiple countries having the same number of users, indicate all of their names.
SQL: SELECT answer.answertext FROM answer INNER JOIN question ON answer.questionid = question.questionid WHERE question.questionid = 3 GROUP BY answer.answertext ORDER BY count(answer.userid) DESC LIMIT 1
Database: mental_health_survey
Note: Average age refer to AVG(answertext) where questionid = 1; respondents in the United States refers to answertext = 'United States' where questionid = 3;
Question: What is the average age of the survey respondents in the United States?
SQL: SELECT cast(sum(answer.answertext) AS REAL) / count(answer.userid) FROM answer INNER JOIN ( SELECT answer.userid FROM answer INNER JOIN question ON answer.questionid = question.questionid WHERE question.questionid = 3 AND answer.answertext = 'United States' ) ON answer.userid = question.userid INNER JOIN question ON answer.questionid = question.questionid WHERE question.questionid = 1
Database: mental_health_survey
Note: Percentage = DIVIDE(SUM(answertext = 'Yes' Or answertext = 'Maybe'), COUNT(questionid = 12))* 100;
Question: What is the percentage of the the users who would bring up a mental health issue with a potential employer in an interview?
SQL: SELECT cast(sum(CASE  WHEN answer.answertext LIKE 'Yes' THEN 1 ELSE 0 END) AS REAL) * 100 / count(answer.userid) FROM answer INNER JOIN question ON answer.questionid = question.questionid WHERE question.questionid = 12
Database: mental_health_survey
Note: 2014 refer to surveyid; COUNT(questionid) where COUNT(answertext) > 200;
Question: How many questions in 2014's survey had more than 200 answers?
SQL: SELECT count(questionid) FROM answer WHERE surveyid LIKE 2014 GROUP BY questionid ORDER BY count(questionid) > 200 LIMIT 1
Database: mental_health_survey
Note: what is your age? refer to questiontext; 2014 refer to surveyid; oldest age refers to MAX(answertext);
Question: What is the oldest age of the users in 2014's survey?
SQL: SELECT answer.answertext FROM question INNER JOIN answer ON question.questionid = answer.questionid WHERE question.questiontext = 'What is your age?' AND answer.surveyid = 2014 ORDER BY answer.answertext DESC LIMIT 1
Database: mental_health_survey
Note: 2014 refer to surveyid; answered No refer to answertext = 'No'; question refer to questiontext;
Question: 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?
SQL: SELECT count(answer.userid) FROM question INNER JOIN answer ON question.questionid = answer.questionid WHERE question.questiontext = 'Would you bring up a mental health issue with a potential employer in an interview?' AND answer.surveyid = 2014 AND answer.answertext LIKE 'NO'
Database: mental_health_survey
Note: 2014 refer to surveyid; question refer to questiontext; yes refer to answertext = 'Yes';
Question: Please list the IDs of the users who answered "Yes" to the question "Do you think that discussing a physical health issue with your employer would have negative consequences?" in 2014's survey.
SQL: SELECT answer.userid FROM question INNER JOIN answer ON question.questionid = answer.questionid WHERE question.questiontext = 'Do you think that discussing a physical health issue with your employer would have negative consequences?' AND answer.answertext LIKE 'Yes' AND answer.surveyid = 2014
Database: mental_health_survey
Note: mental health survey for 2014 refers to surveyid = 2014;
Question: How many users participated in the mental health survey for 2014?
SQL: SELECT count(DISTINCT answer.userid) FROM answer INNER JOIN survey ON answer.surveyid = survey.surveyid WHERE survey.description = 'mental health survey for 2014'
Database: mental_health_survey
Note: question refers to questiontext; the answers that are not null refers to answertext ! = -1;
Question: Please list all the answers to the question "Any additional notes or comments" that are not null in 2014's survey.
SQL: SELECT answer.answertext FROM question INNER JOIN answer ON question.questionid = answer.questionid WHERE question.questiontext = 'Any additional notes or comments' AND answer.surveyid = 2014 AND answer.answertext <> -1
Database: mental_health_survey
Note: question refers to questiontext; all the common questions in 2014's survey and 2016's survey refers to questionid(surveyid(2014)) = questionid(surveyid(2016));
Question: Please list all the common questions in 2014's survey and 2016's survey.
SQL: SELECT question.questiontext FROM question INNER JOIN answer ON question.questionid = answer.questionid WHERE answer.surveyid IN (2014, 2016) GROUP BY question.questiontext
Database: mental_health_survey
Note: lived in Canada refers to answertext(questionid(3)) = 'Canada';
Question: How many users lived in Canada according to 2018's survey?
SQL: SELECT count(answer.userid) FROM question INNER JOIN answer ON question.questionid = answer.questionid WHERE answer.surveyid = 2018 AND question.questiontext = 'What country do you live in?' AND answer.answertext = 'Canada'
Database: mental_health_survey
Note: mental health survey for 2014 refers to surveyid = 2014;
Question: Please list all the questions in the mental health survey for 2014.
SQL: SELECT question.questiontext FROM answer INNER JOIN question ON answer.questionid = question.questionid INNER JOIN survey ON answer.surveyid = survey.surveyid WHERE survey.description LIKE 'mental health survey for 2014' GROUP BY question.questiontext
Database: mental_health_survey
Note: users with a mental health disorder in the past refers to answertext(questionid(32)) = 'Yes';
Question: According to 2016's survey, what is the number of users with a mental health disorder in the past?
SQL: SELECT count(answer.userid) FROM question INNER JOIN answer ON question.questionid = answer.questionid WHERE answer.surveyid = 2016 AND question.questiontext LIKE 'Have you had a mental health disorder in the past?' AND answer.answertext = 'Yes'
Database: mental_health_survey
Note: question refers to questiontext; answered 'Yes' to question refers to answertext = 'Yes'; 3 consecutive years starting from 2016 refers to surveyid = 2016 and surveyid = 2017 and surveyid = 2018;
Question: How many users answered "Yes" to the question "Have you had a mental health disorder in the past?" in 3 consecutive years starting from 2016?
SQL: SELECT count(answer.userid) FROM question INNER JOIN answer ON question.questionid = answer.questionid WHERE answer.surveyid IN (2016, 2017, 2018) AND question.questiontext LIKE 'Have you had a mental health disorder in the past?' AND answer.answertext = 'Yes'
Database: mental_health_survey
Note: average result refers to avg(answertext(surveyid = 2014& questionid = 1));
Question: What is the average result of the question "What is your age?" in 2014's survey?
SQL: SELECT cast(sum(answer.answertext) AS REAL) / count(answer.userid) AS "avg" FROM question INNER JOIN answer ON question.questionid = answer.questionid WHERE answer.surveyid = 2014 AND question.questiontext LIKE 'What is your age?'
Database: mental_health_survey
Note: 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)));
Question: What is the rate of increase of users with a current mental disorder from 2019's survey to 2016's survey?
SQL: SELECT cast(( SELECT count(answer.userid) FROM question INNER JOIN answer ON question.questionid = answer.questionid WHERE answer.surveyid = 2019 AND question.questiontext LIKE 'Do you currently have a mental health disorder?' AND answer.answertext = 'Yes' ) - ( SELECT count(answer.userid) FROM question INNER JOIN answer ON question.questionid = answer.questionid WHERE answer.surveyid = 2016 AND question.questiontext LIKE 'Do you currently have a mental health disorder?' AND answer.answertext = 'Yes' ) AS REAL) * 100 / ( SELECT count(answer.userid) FROM question INNER JOIN answer ON question.questionid = answer.questionid WHERE answer.surveyid = 2016 AND question.questiontext LIKE 'Do you currently have a mental health disorder?' AND answer.answertext = 'Yes' )
Database: mental_health_survey
Question: Tell the question ID for "Would you bring up a physical health issue with a potential employer in an interview?".
SQL: SELECT questionid FROM question WHERE questiontext LIKE 'Would you bring up a physical health issue with a potential employer in an interview?'
Database: mental_health_survey
Note: question No.20 refers to questionid = 20;
Question: How many users answered the question No.20?
SQL: SELECT max(userid) - min(userid) + 1 FROM answer WHERE questionid = 20
Database: mental_health_survey
Note: user No.5 refers to userid = 5;
Question: How many questions did user No.5 answer?
SQL: SELECT count(questionid) FROM answer WHERE userid = 5
Database: mental_health_survey
Note: survey No.2016 refers to surveyid = 2016;
Question: How many users participated in the Survey No.2016?
SQL: SELECT count(DISTINCT userid) FROM answer WHERE surveyid LIKE 2016
Database: mental_health_survey
Note: mental health survey for 2018 refers to surveyid = 2018;
Question: State the number of questions that were asked in the "mental health survey for 2018".
SQL: SELECT count(answer.questionid) FROM answer INNER JOIN survey ON answer.surveyid = survey.surveyid WHERE survey.description = 'mental health survey for 2018'
Database: mental_health_survey
Note: question refers to questiontext;
Question: Tell the number of surveys that contained the question “What country do you work in?”.
SQL: SELECT count(DISTINCT answer.questionid) FROM answer INNER JOIN question ON answer.questionid = question.questionid INNER JOIN survey ON answer.surveyid = survey.surveyid WHERE question.questiontext = 'What country do you work in?'
Database: mental_health_survey
Note: question refers to questiontext; user No. 2681 refers to userid = 2681;
Question: What answer did user No. 2681 give to the question "Do you currently have a mental health disorder?"?
SQL: SELECT answer.answertext FROM answer INNER JOIN question ON answer.questionid = question.questionid WHERE question.questiontext = 'Do you currently have a mental health disorder?' AND answer.userid = 2681
Database: mental_health_survey
Note: mental health survey for 2016 refers to surveyid = 2016;
Question: Provide the number of users who took part in the "mental health survey for 2016".
SQL: SELECT count(DISTINCT answer.userid) FROM answer INNER JOIN survey ON answer.surveyid = survey.surveyid WHERE survey.description = 'mental health survey for 2016'
Database: mental_health_survey
Note: most common answer refers to answertext where MAX(COUNT(answertext(questionid = 3)));
Question: What was the most common answer for the question "What country do you work in?"?
SQL: SELECT answer.answertext FROM answer INNER JOIN question ON answer.questionid = question.questionid WHERE question.questiontext = 'What country do you work in?' GROUP BY answer.answertext ORDER BY count(answer.answertext) DESC LIMIT 1
Database: mental_health_survey
Question: 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?
SQL: SELECT count(DISTINCT answer.answertext) FROM answer INNER JOIN question ON answer.questionid = question.questionid WHERE question.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.'
Database: mental_health_survey
Note: question refers to questiontext; answertext = 'Kansas';
Question: For the question “What US state or territory do you work in?”, how many people gave "Kansas" as the answer?
SQL: SELECT count(answer.userid) FROM answer INNER JOIN question ON answer.questionid = question.questionid WHERE question.questiontext LIKE 'What US state or territory do you work in?' AND answer.answertext = 'Kansas'
Database: mental_health_survey
Note: question refers to questiontext; wrote comments refers to answertext(questionid = 103) ! = -1;
Question: How many people wrote comments for the question "Any additional notes or comments."?
SQL: SELECT count(answer.userid) FROM answer INNER JOIN question ON answer.questionid = question.questionid WHERE question.questiontext LIKE 'Any additional notes or comments' AND answer.answertext IS NOT NULL
Database: mental_health_survey
Note: have asked refers to questiontext; said 'Yes' refers to answertext = 'Yes';
Question: For all the users who have been asked "Have you ever been diagnosed with a mental health disorder?", how many of them said "Yes"?
SQL: SELECT count(answer.userid) FROM answer INNER JOIN question ON answer.questionid = question.questionid WHERE question.questiontext LIKE 'Have you ever been diagnosed with a mental health disorder?' AND answer.answertext = 'Yes'
Database: mental_health_survey
Note: mental health survey for 2018 refers to surveyid = 2018;
Question: Give the number of users who took the "mental health survey for 2018".
SQL: SELECT count(DISTINCT answer.userid) FROM answer INNER JOIN survey ON answer.surveyid = survey.surveyid WHERE survey.description = 'mental health survey for 2018'
Database: mental_health_survey
Note: question refers to questiontext;
Question: How many users answered the question "Overall, how much importance does your employer place on physical health?"?
SQL: SELECT count(answer.userid) FROM answer INNER JOIN question ON answer.questionid = question.questionid WHERE question.questiontext LIKE 'Overall, how much importance does your employer place on physical health?'
Database: mental_health_survey
Note: question refers to questiontext; user No.2183 refers to userid = 2183;
Question: For which question did the user No.2183 gave the answer "Mood Disorder (Depression, Bipolar Disorder, etc)"?
SQL: SELECT answer.answertext FROM answer INNER JOIN question ON answer.questionid = question.questionid WHERE question.questionid = 2183 AND answer.answertext = 'Mood Disorder (Depression, Bipolar Disorder, etc)'
Database: mental_health_survey
Note: percentage = divide(count(questionid = 15& answertext = 'Yes'), count(questionid = 15))*100%;
Question: 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)?"?
SQL: SELECT cast(sum(CASE  WHEN answer.answertext LIKE 'Yes' THEN 1 ELSE 0 END) AS REAL) * 100 / count(answer.userid) FROM answer INNER JOIN question ON answer.questionid = question.questionid WHERE question.questiontext LIKE 'Has your employer ever formally discussed mental health (for example, as part of a wellness campaign or other official communication)?'
Database: mental_health_survey
Note: How many times more = subtract(count(userid(surveyid = 2017)), count(userid(surveyid = 2018)));
Question: How many times more for the number of users who took the "mental health survey for 2017" than "mental health survey for 2018"?
SQL: SELECT cast(count(answer.userid) AS REAL) / ( SELECT count(answer.userid) FROM answer INNER JOIN survey ON answer.surveyid = survey.surveyid WHERE survey.description = 'mental health survey for 2018' ) FROM answer INNER JOIN survey ON answer.surveyid = survey.surveyid WHERE survey.description = 'mental health survey for 2017'
Database: mental_health_survey
Note: respondents and 'users' are synonyms; percentage = divide(count(surveyid = 2016& questionid = 32 & answertext = 'Yes'), count(surveyid = 2016& questionid = 32))*100%;
Question: Among respondents who participated in the survey in 2016, what percentage had a mental health disorder in the past?
SQL: SELECT cast(sum(CASE  WHEN answer.answertext LIKE 'Yes' THEN 1 ELSE 0 END) AS REAL) * 100 / count(answer.surveyid) FROM answer INNER JOIN question ON answer.questionid = question.questionid WHERE answer.questionid = 32 AND answer.surveyid = 2016
Database: mental_health_survey
Note: respondents' and 'users' are synonyms; younger than 25 years old refers to answertext(surveyid = 2016& questionid = 1)< 25;
Question: How many respondents younger than 25 years old did participate in the survey in 2016?
SQL: SELECT count(DISTINCT answer.userid) FROM answer INNER JOIN question ON answer.questionid = question.questionid WHERE answer.questionid = 1 AND answer.surveyid = 2016 AND answer.answertext <= 25
Database: mental_health_survey
Note: respondents and 'users' are synonyms; average number = avg(count(userid(surveyid = 2014)), count(userid(surveyid = 2019)));
Question: What is the average number of respondents per survey between 2014 and 2019?
SQL: SELECT cast(count(surveyid) AS REAL) / 5 FROM answer WHERE surveyid BETWEEN 2014 AND 2019
Database: mental_health_survey
Note: 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;
Question: How many respondents who participated in the survey in 2019 have ever sought treatment for a mental health disorder from a mental health professional?
SQL: SELECT count(answer.userid) FROM answer INNER JOIN question ON answer.questionid = question.questionid WHERE answer.questionid = 7 AND answer.surveyid = 2019 AND answer.answertext = 1
Database: mental_health_survey
Note: respondents' and 'users' are synonyms; work remotely at least 50% of the time refers to answertext(surveyid = 2014& questionid = 93) = 'Yes';
Question: How many respondents who participated in the survey in 2014 work remotely at least 50% of the time?
SQL: SELECT count(answer.answertext) FROM answer INNER JOIN question ON answer.questionid = question.questionid WHERE answer.questionid = 93 AND answer.surveyid = 2014 AND answer.answertext = 'Yes'
Database: mental_health_survey
Question: How many questions were asked in the questionary for the mental health survey?
SQL: SELECT count(questiontext) FROM question
Database: mental_health_survey
Note: respondents' and 'users' are synonyms;
Question: How many respondents of the mental health survey were diagnosed with 'Substance Use Disorder'?
SQL: SELECT count(answertext) FROM answer WHERE answertext LIKE 'Substance Use Disorder'
Database: mental_health_survey
Note: survey in 2017 refers to surveyid = 2017; questionid = 85; MAX(COUNT(answertext));
Question: List the top three popular responses to the question of the survey in 2017 with the question ID no.85.
SQL: SELECT answertext FROM answer WHERE questionid = 85 AND surveyid = 2017 GROUP BY answertext ORDER BY count(answertext) DESC LIMIT 3
Database: disney
Note: SUBTRACT(SUM(year = 1998), SUM(year = 1997));
Question: How much more total box office gross did the Walt Disney Company have in revenue in 1998 than in 1997?
SQL: SELECT sum(CASE WHEN `year` = 1998 THEN total ELSE 0 END) - sum(CASE WHEN `year` = 1997 THEN total ELSE 0 END) FROM revenue
Database: disney
Note: studio entertainment[ni 1]' > 'disney media networks' where year = 1998;
Question: In which segment did the Walt Disney Company earned a bigger revenue in 1998, Studio Entertainment or Disney Media Networks?
SQL: SELECT CASE WHEN 'Studio Entertainment[NI 1]' > 'Disney Media Networks' THEN 'Studio Entertainment[NI 1]' ELSE 'Disney Media Networks' END FROM revenue WHERE `year` = 1998
Database: disney
Note: Pinocchio is the name of the movie;
Question: Who is the director of the movie Pinocchio?
SQL: SELECT director FROM director WHERE name = 'Pinocchio'
Database: disney
Note: Wolfgang Reitherman refers to director = 'Wolfgang Reitherman';
Question: Please list the villains of all the movies directed by Wolfgang Reitherman.
SQL: SELECT characters.villian FROM director INNER JOIN characters ON director.name = characters.movie_title WHERE director.director = 'Wolfgang Reitherman' AND characters.villian IS NOT NULL
Database: disney
Note: Wolfgang Reitherman refers to director = 'Wolfgang Reitherman'; released in December refers to (release_date, instr(release_date, '-') + 1, 3) = 'Dec';
Question: Among the movies directed by Wolfgang Reitherman, how many of them were released in December?
SQL: SELECT count(movie_title) FROM characters INNER JOIN director ON characters.movie_title = director.name WHERE substr(release_date, instr(release_date, '-') + 1, 3) = 'Dec' AND director.director = 'Wolfgang Reitherman'
Database: disney
Note: directed by whom refers to director; movie refers to movie_title;
Question: The song "Once Upon a Dream" is associated with the movie directed by whom?
SQL: SELECT director.director FROM characters INNER JOIN director ON characters.movie_title = director.name WHERE characters.song = 'Once Upon a Dream'
Database: disney
Note: Alice in Wonderland refers to movie_title = 'Alice in Wonderland'; villain refers to character like '%'||T1.villian||'%';
Question: Who is the voice actor for the villain of the movie "Alice in Wonderland"?
SQL: SELECT voice-actors.`voice-actor` FROM `voice-actors` INNER JOIN characters ON voice-actors.movie = characters.movie_title WHERE voice-actors.character LIKE '%' OR characters.villian OR '%' AND characters.movie_title = 'Alice in Wonderland'
Database: disney
Note: FALSE;
Question: Please list the release dates of all the movies in which Alan Tudyk is a voice actor.
SQL: SELECT characters.release_date FROM `voice-actors` INNER JOIN characters ON voice-actors.movie = characters.movie_title WHERE voice-actors.`voice-actor` = 'Alan Tudyk'
Database: disney
Note: released after 2012 refers to (release_date, instr(release_date, '-') + 5) > 12;
Question: Among the movies in which Alan Tudyk is a voice actor, how many of them were released after 2012?
SQL: SELECT count(voice-actors.movie) FROM characters INNER JOIN `voice-actors` ON characters.movie_title = voice-actors.movie WHERE voice-actors.`voice-actor` = 'Alan Tudyk' AND substr(release_date, instr(release_date, '-') + 5) > 12