input
stringlengths
193
2.69k
output
stringlengths
24
744
[INST] Here is a database schema: Answer : AnswerText [ TEXT ] SurveyID [ INTEGER ] UserID [ INTEGER ] QuestionID [ INTEGER ] Please write me a SQL statement that answers the following question: List the top three popular responses to the question of the survey in 2017 with the question ID no.85. [/INST]
SELECT AnswerText FROM Answer WHERE QuestionID = 85 AND SurveyID = 2017 GROUP BY AnswerText ORDER BY COUNT(AnswerText) DESC LIMIT 3;
[INST] Here is a database schema: director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] Please write me a SQL statement that answers the following question: Who is the director of the movie Pinocchio? [/INST]
SELECT director FROM director WHERE name = 'Pinocchio';
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] Please write me a SQL statement that answers the following question: Please list the villains of all the movies directed by Wolfgang Reitherman. [/INST]
SELECT T2.villian FROM director AS T1 INNER JOIN characters AS T2 ON T1.name = T2.movie_title WHERE T1.director = 'Wolfgang Reitherman' AND T2.villian IS NOT NULL;
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] Please write me a SQL statement that answers the following question: Among the movies directed by Wolfgang Reitherman, how many of them were released in December? [/INST]
SELECT COUNT(movie_title) FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE SUBSTR(release_date, INSTR(release_date, '-') + 1, 3) = 'Dec' AND T2.director = 'Wolfgang Reitherman';
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] Please write me a SQL statement that answers the following question: The song "Once Upon a Dream" is associated with the movie directed by whom? [/INST]
SELECT T2.director FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T1.song = 'Once Upon a Dream';
[INST] Here is a database schema: director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: Among the movies directed by Wolfgang Reitherman, which one of them was the most popular? [/INST]
SELECT T2.movie_title FROM director AS T1 INNER JOIN movies_total_gross AS T2 ON T1.name = T2.movie_title WHERE T1.director = 'Wolfgang Reitherman' ORDER BY T2.total_gross DESC LIMIT 1;
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: What is the genre of the movie whose villain is Commander Rourke? [/INST]
SELECT T2.genre FROM characters AS T1 INNER JOIN movies_total_gross AS T2 ON T2.movie_title = T1.movie_title WHERE T1.villian = 'Commander Rourke';
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] Please write me a SQL statement that answers the following question: Who is the villain of the movie "Beauty and the Beast"? [/INST]
SELECT villian FROM characters WHERE movie_title = 'Beauty and the Beast';
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] Please write me a SQL statement that answers the following question: Which movie is the character Robin Hood in? [/INST]
SELECT movie_title FROM characters WHERE hero = 'Robin Hood';
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] Please write me a SQL statement that answers the following question: Give the name of the movie which the song "I Thought I Lost You" is associated with. [/INST]
SELECT movie_title FROM characters WHERE song = 'I Thought I Lost You';
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: Who is the hero character of the movie whose total gross was $222,527,828? [/INST]
SELECT T1.hero FROM characters AS T1 INNER JOIN movies_total_gross AS T2 ON T2.movie_title = T1.movie_title WHERE T2.total_gross = '$222,527,828';
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: Which song is associated with the most popular Disney movie in 1970s? [/INST]
SELECT T2.song FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title WHERE CAST(SUBSTR(T1.release_date, INSTR(T1.release_date, ', ') + 1) AS int) BETWEEN 1970 AND 1979 ORDER BY CAST(REPLACE(SUBSTR(T1.total_gross, 2), ',', '') AS float) DESC LIMIT 1;
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] Please write me a SQL statement that answers the following question: Who is the hero character of the Disney movie directed by Will Finn? [/INST]
SELECT T1.hero FROM characters AS T1 INNER JOIN director AS T2 ON T2.name = T1.movie_title WHERE T2.director = 'Will Finn';
[INST] Here is a database schema: director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: Who is the director of the adventure movie which was released on 2007/3/30? [/INST]
SELECT T1.director FROM director AS T1 INNER JOIN movies_total_gross AS T2 ON T2.movie_title = T1.name WHERE T2.genre = 'Adventure' AND T2.release_date = 'Mar 30, 2007';
[INST] Here is a database schema: director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: Wolfgang Reitherman has directed several Disney movies, which one has the highest grossing after accounting for inflation? [/INST]
SELECT T1.movie_title FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Wolfgang Reitherman' ORDER BY CAST(REPLACE(SUBSTR(inflation_adjusted_gross, 2), ',', '') AS REAL) DESC LIMIT 1;
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: Who is the hero character of the adventure movie which was released on 2016/3/4? [/INST]
SELECT T1.hero FROM characters AS T1 INNER JOIN movies_total_gross AS T2 ON T2.movie_title = T1.movie_title WHERE T2.genre = 'Adventure' AND T1.release_date = '4-Mar-16';
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: The character Donald Duck has appeared in two Disney movies, which one has more grossing? [/INST]
SELECT T1.movie_title FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title WHERE T2.hero = 'Donald Duck' ORDER BY CAST(REPLACE(SUBSTR(total_gross, 2), ',', '') AS REAL) DESC LIMIT 1;
[INST] Here is a database schema: director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] Please write me a SQL statement that answers the following question: How many movies did Wolfgang Reitherman direct? [/INST]
SELECT COUNT(name) FROM director WHERE director = 'Wolfgang Reitherman';
[INST] Here is a database schema: director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] Please write me a SQL statement that answers the following question: Who is the most productive director? [/INST]
SELECT director FROM director GROUP BY director ORDER BY COUNT(name) DESC LIMIT 1;
[INST] Here is a database schema: movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: How many restricted horror movies were released between 1/1/1990 to 12/31/2015? [/INST]
SELECT COUNT(movie_title) FROM movies_total_gross WHERE MPAA_rating = 'R' AND genre = 'Horror' AND CAST(SUBSTR(release_date, INSTR(release_date, ', ') + 1) AS int) BETWEEN 1990 AND 2015;
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: How much is the total gross of the movie with a song titled "Little Wonders"? [/INST]
SELECT T1.total_gross FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T2.movie_title = T1.movie_title WHERE T2.song = 'Little Wonders';
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: What is the Motion Picture Association of America rating for the movie featuring a villain named Turbo? [/INST]
SELECT T1.MPAA_rating FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T2.movie_title = T1.movie_title WHERE T2.villian = 'Turbo';
[INST] Here is a database schema: director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: How many of Gary Trousdale's movies are adventure movies? [/INST]
SELECT COUNT(T.name) FROM ( SELECT T1.name FROM director AS T1 INNER JOIN movies_total_gross AS T2 ON T1.name = T2.movie_title WHERE T1.director = 'Gary Trousdale' AND T2.genre = 'Adventure' GROUP BY T1.name ) T;
[INST] Here is a database schema: director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: What is the most popular movie directed by Ron Clements? [/INST]
SELECT T2.name FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T2.name = T1.movie_title WHERE T2.director = 'Ron Clements' ORDER BY CAST(REPLACE(SUBSTR(total_gross, 2), ',', '') AS int) DESC LIMIT 1;
[INST] Here is a database schema: director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: How many PG adventure movies did Ron Clements direct? [/INST]
SELECT COUNT(*) FROM director AS T1 INNER JOIN movies_total_gross AS T2 ON T1.name = T2.movie_title WHERE T1.director = 'Ron Clements' AND T2.MPAA_rating = 'PG' AND T2.genre = 'Adventure';
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] Please write me a SQL statement that answers the following question: Who is the villain in the movie "The Great Mouse Detective"? [/INST]
SELECT villian FROM characters WHERE movie_title = 'The Great Mouse Detective';
[INST] Here is a database schema: director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] Please write me a SQL statement that answers the following question: Which director has made the most movies? [/INST]
SELECT director, COUNT(name) FROM director GROUP BY director ORDER BY COUNT(name) DESC LIMIT 1;
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: List all the songs associated with drama movies. [/INST]
SELECT song FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title WHERE T1.genre = 'Drama' GROUP BY song;
[INST] Here is a database schema: director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: Provide a list of directors from the 1990s. [/INST]
SELECT T2.director FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name AND CAST(SUBSTR(release_date, INSTR(release_date, ', ') + 1) AS int) BETWEEN 1990 AND 2000 GROUP BY T2.director;
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: What is the highest grossing movie without a song? [/INST]
SELECT T1.movie_title FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T2.movie_title = T1.movie_title WHERE T2.song IS NULL ORDER BY CAST(REPLACE(trim(T1.total_gross, '$'), ',', '') AS REAL) DESC LIMIT 1;
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] Please write me a SQL statement that answers the following question: List the directors of movies that feature a song. [/INST]
SELECT T2.director FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T1.song IS NOT NULL GROUP BY T2.director;
[INST] Here is a database schema: director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: Which of the movies directed by Ron Clements has the highest total gross? [/INST]
SELECT T2.movie_title FROM director AS T1 INNER JOIN movies_total_gross AS T2 ON T1.name = T2.movie_title WHERE T1.director = 'Ron Clements' ORDER BY CAST(REPLACE(trim(T2.total_gross, '$'), ',', '') AS REAL) DESC LIMIT 1;
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: What proportion of the total gross of all movies is from movies with songs? [/INST]
SELECT CAST(COUNT(CASE WHEN T1.song IS NOT NULL THEN T2.movie_title ELSE NULL END) AS REAL) * 100 / COUNT(T2.movie_title) FROM characters AS T1 INNER JOIN movies_total_gross AS T2 ON T1.movie_title = T2.movie_title;
[INST] Here is a database schema: movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: List the movies and genres released in 2016. [/INST]
SELECT movie_title, genre FROM movies_total_gross WHERE SUBSTR(release_date, LENGTH(release_date) - 3, LENGTH(release_date)) = '2016';
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] Please write me a SQL statement that answers the following question: Who is the villain in Little Mermaid? [/INST]
SELECT villian FROM characters WHERE movie_title = 'Little Mermaid';
[INST] Here is a database schema: director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] Please write me a SQL statement that answers the following question: List the movie titles directed by Jack Kinney. [/INST]
SELECT name FROM director WHERE director = 'Jack Kinney';
[INST] Here is a database schema: movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: Provide the movie titles and the estimated inflation rate of the highest total grossed movie. [/INST]
SELECT movie_title, CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL) / CAST(REPLACE(trim(total_gross, '$'), ',', '') AS REAL) FROM movies_total_gross ORDER BY CAST(REPLACE(trim(total_gross, '$'), ',', '') AS REAL) DESC LIMIT 1;
[INST] Here is a database schema: movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: List the PG-13 romantic comedy movie titles and their release dates. [/INST]
SELECT movie_title, release_date FROM movies_total_gross WHERE MPAA_rating = 'PG-13' AND genre = 'Romantic Comedy';
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] Please write me a SQL statement that answers the following question: List the movie titles and associated songs directed by Ron Clements. [/INST]
SELECT T1.movie_title, T1.song FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Ron Clements';
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: Provide the titles, main characters, and associated songs of the movies directed by Wolfgang Reitherman in 1977. [/INST]
SELECT T1.movie_title, T2.hero, T2.song FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title INNER JOIN director AS T3 ON T1.movie_title = T3.name WHERE T3.director = 'Wolfgang Reitherman' AND SUBSTR(T1.release_date, LENGTH(T1.release_date) - 3, LENGTH(T1.release_date)) = '1977';
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] Please write me a SQL statement that answers the following question: Which movies had the main character named Donald Duck and who directed them? [/INST]
SELECT T1.movie_title, T2.director FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T1.hero = 'Donald Duck';
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] Please write me a SQL statement that answers the following question: Describe the hero, director, and the release date of Mulan. [/INST]
SELECT T1.hero, T2.director, T1.release_date FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T1.movie_title = 'Mulan';
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: Provide the title, total gross, and MPAA rating of the movie which has a hero named Elsa. [/INST]
SELECT T1.movie_title, T1.total_gross, T1.MPAA_rating FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title INNER JOIN director AS T3 ON T3.name = T1.movie_title WHERE T2.hero = 'Elsa';
[INST] Here is a database schema: director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: Who directed the most popular movie? [/INST]
SELECT T2.director FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name ORDER BY CAST(REPLACE(trim(T1.total_gross, '$'), ',', '') AS REAL) DESC LIMIT 1;
[INST] Here is a database schema: director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: Provide the directors and MPAA ratings of the musical movies released in 1993. [/INST]
SELECT T2.director, T1.MPAA_rating FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T1.genre = 'Musical' AND SUBSTR(T1.release_date, LENGTH(T1.release_date) - 3, LENGTH(T1.release_date)) = '1993';
[INST] Here is a database schema: director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: Among the movies released from 1991 to 2000, calculate the percentage of comedy movies. Provide any five movie titles and directors. [/INST]
SELECT CAST(COUNT(CASE WHEN T1.genre = 'Comedy' THEN T1.movie_title ELSE NULL END) AS REAL) * 100 / COUNT(T1.movie_title), group_concat(T1.movie_title), group_concat(T2.director) FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE SUBSTR(T1.release_date, LENGTH(T1.release_date) - 3, LENGTH(T1.release_date)) BETWEEN '1991' AND '2000';
[INST] Here is a database schema: director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: Among the movies released from 2001 to 2005, list down the titles and directors of the movies which had a total gross of more than 100% above the average. [/INST]
SELECT T2.name, T2.director FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE SUBSTR(T1.release_date, LENGTH(T1.release_date) - 3, LENGTH(T1.release_date)) BETWEEN '2001' AND '2005' AND CAST(REPLACE(trim(T1.total_gross, '$'), ',', '') AS REAL) / ( SELECT SUM(CAST(REPLACE(trim(T3.total_gross, '$'), ',', '') AS REAL)) / COUNT(T3.movie_title) AS avg_gross FROM movies_total_gross AS T3 INNER JOIN director AS T4 ON T3.movie_title = T4.name WHERE SUBSTR(T3.release_date, LENGTH(T3.release_date) - 3, LENGTH(T3.release_date)) BETWEEN '2001' AND '2005' ) - 1 > 1;
[INST] Here is a database schema: director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] Please write me a SQL statement that answers the following question: Provide the director's name of Wreck-It Ralph movie. [/INST]
SELECT director FROM director WHERE name = 'Wreck-It Ralph';
[INST] Here is a database schema: director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] Please write me a SQL statement that answers the following question: What movies did director Jack Kinney direct? [/INST]
SELECT name FROM director WHERE director = 'Jack Kinney';
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] Please write me a SQL statement that answers the following question: How many movies were released between 1937 and 1950? [/INST]
SELECT COUNT(movie_title) FROM characters WHERE SUBSTR(release_date, LENGTH(release_date) - 1, LENGTH(release_date)) BETWEEN '37' AND '50';
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] Please write me a SQL statement that answers the following question: Provide the name of the song from the movie directed by Ben Sharpsteen. [/INST]
SELECT T1.song FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Ben Sharpsteen';
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] Please write me a SQL statement that answers the following question: Indicate the release date of the film The Lion King directed by Roger Allers. [/INST]
SELECT T1.release_date FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Roger Allers' AND T1.movie_title = 'The Lion King';
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] Please write me a SQL statement that answers the following question: Which movies of director Wolfgang Reitherman do not have villain? [/INST]
SELECT T1.movie_title FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Wolfgang Reitherman' AND T1.villian IS NULL;
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] Please write me a SQL statement that answers the following question: List the titles of movies directed by Jack Kinney that were released before 1947. [/INST]
SELECT T1.movie_title FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Jack Kinney' AND SUBSTR(T1.release_date, LENGTH(T1.release_date) - 1, LENGTH(T1.release_date)) < '47';
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: List the names of the directors whose films grossed over $100 million. [/INST]
SELECT DISTINCT T2.director FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name INNER JOIN movies_total_gross AS T3 ON T1.movie_title = T3.movie_title WHERE CAST(REPLACE(trim(T3.total_gross, '$'), ',', '') AS REAL) > 100000000;
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: Which movie's song title has the highest total gross? [/INST]
SELECT T2.song FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title ORDER BY CAST(REPLACE(trim(T1.total_gross, '$'), ',', '') AS REAL) DESC LIMIT 1;
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: Which director had the most popular film from 1937 to 1990? [/INST]
SELECT T2.director FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name INNER JOIN movies_total_gross AS T3 ON T3.movie_title = T1.movie_title WHERE SUBSTR(T3.release_date, LENGTH(T3.release_date) - 3, LENGTH(T3.release_date)) BETWEEN '1937' AND '1990' ORDER BY CAST(REPLACE(trim(T3.total_gross, '$'), ',', '') AS REAL) DESC LIMIT 1;
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: List all the main characters of the movie that are comedy genre. [/INST]
SELECT T2.hero FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title WHERE T1.genre = 'Comedy';
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: What genre of movie has Taran as the main character? [/INST]
SELECT T1.genre FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title WHERE T2.hero = 'Taran';
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: Calculate the percentage of directors whose films grossed over $100 million. [/INST]
SELECT CAST(COUNT(DISTINCT CASE WHEN CAST(REPLACE(trim(T1.total_gross, '$'), ',', '') AS REAL) > 100000000 THEN T3.director ELSE NULL END) AS REAL) * 100 / COUNT(DISTINCT T3.director) FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title INNER JOIN director AS T3 ON T1.movie_title = T3.name;
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] Please write me a SQL statement that answers the following question: Name the first movie released by Disney. [/INST]
SELECT movie_title FROM characters ORDER BY SUBSTR(release_date, LENGTH(release_date) - 1, LENGTH(release_date)) ASC LIMIT 1;
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] Please write me a SQL statement that answers the following question: How many movies were released by Disney between 2010 and 2016? [/INST]
SELECT COUNT(movie_title) FROM characters WHERE SUBSTR(release_date, LENGTH(release_date) - 1, LENGTH(release_date)) BETWEEN '10' AND '16';
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] Please write me a SQL statement that answers the following question: Who was the first ever Disney villain? [/INST]
SELECT villian FROM characters ORDER BY SUBSTR(release_date, LENGTH(release_date) - 1, LENGTH(release_date)) DESC LIMIT 1;
[INST] Here is a database schema: movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: What is Disney's highest grossing action movie? [/INST]
SELECT movie_title FROM movies_total_gross WHERE genre = 'Action' ORDER BY CAST(REPLACE(trim(total_gross, '$'), ',', '') AS REAL) DESC LIMIT 1;
[INST] Here is a database schema: characters : movie_title [ TEXT ] primary_key release_date [ TEXT ] hero [ TEXT ] characters.hero = voice-actors.character villian [ TEXT ] song [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: Name the main character of Disney's most popular adventure movie based on its inflation-adjusted gross. [/INST]
SELECT T2.hero FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title WHERE T1.genre = 'Adventure' ORDER BY CAST(REPLACE(trim(T1.inflation_adjusted_gross, '$'), ',', '') AS REAL) DESC LIMIT 1;
[INST] Here is a database schema: director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: Name the director of Disney's lowest grossing movie. [/INST]
SELECT T2.director FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name ORDER BY CAST(REPLACE(trim(T1.total_gross, '$'), ',', '') AS REAL) ASC LIMIT 1;
[INST] Here is a database schema: movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: Determine the average gross for Disney's PG-13-rated action movies. [/INST]
SELECT SUM(CAST(REPLACE(trim(total_gross, '$'), ',', '') AS REAL)) / COUNT(movie_title) FROM movies_total_gross WHERE MPAA_rating = 'PG-13';
[INST] Here is a database schema: movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: Find the estimated inflation rate that was used to adjust the 1995 box office revenue for Disney's films. [/INST]
SELECT SUM(CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL)) / SUM(CAST(REPLACE(trim(total_gross, '$'), ',', '') AS REAL)) FROM movies_total_gross WHERE SUBSTR(release_date, LENGTH(release_date) - 3, LENGTH(release_date)) = '1995' GROUP BY SUBSTR(release_date, LENGTH(release_date) - 3, LENGTH(release_date)) = '1995';
[INST] Here is a database schema: movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: What is the difference in the current gross of Cars and its sequel, Cars 2? Which movie is more popular? [/INST]
SELECT SUM(CASE WHEN movie_title = 'Cars' THEN CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL) ELSE 0 END), SUM(CASE WHEN movie_title = 'Cars 2' THEN CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL) ELSE 0 END) FROM movies_total_gross;
[INST] Here is a database schema: director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: Name the most recent movie directed by Chris Buck. Which of his movies was more successful in terms of grossing? Use the current gross for comparison. [/INST]
SELECT T1.movie_title, MAX(T1.release_date), MAX(T1.inflation_adjusted_gross) FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Chris Buck';
[INST] Here is a database schema: movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: Name the top 5 highest-grossing Disney movies adjusted for inflation. Identify the percentage they contributed to the total of Disney's current gross. [/INST]
SELECT SUM(CASE WHEN CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL) > 1236035515 THEN CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL) ELSE 0 END) * 100 / SUM(CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL)) FROM movies_total_gross;
[INST] Here is a database schema: director : name [ TEXT ] primary_key director.name = characters.movie_title director [ TEXT ] movies_total_gross : movie_title [ TEXT ] movies_total_gross.movie_title = characters.movie_title release_date [ TEXT ] genre [ TEXT ] MPAA_rating [ TEXT ] total_gross [ TEXT ] inflation_adjusted_gross [ TEXT ] Please write me a SQL statement that answers the following question: Among all Disney movies directed by Gary Trousdale, determine the percentage that earned over USD100m based on actual grossing. [/INST]
SELECT CAST(COUNT(CASE WHEN CAST(REPLACE(trim(T1.total_gross, '$'), ',', '') AS REAL) > 100000000 THEN T1.movie_title ELSE NULL END) AS REAL) * 100 / COUNT(T1.movie_title) FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Gary Trousdale';
[INST] Here is a database schema: current : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] birthday_bio [ DATE ] cspan_id [ REAL ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ REAL ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ INTEGER ] votesmart_id [ REAL ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] Please write me a SQL statement that answers the following question: How many current legislators do not have an account on ballotpedia.org ? [/INST]
SELECT COUNT(*) FROM current WHERE ballotpedia_id = '' OR ballotpedia_id IS NULL;
[INST] Here is a database schema: current : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] birthday_bio [ DATE ] cspan_id [ REAL ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ REAL ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ INTEGER ] votesmart_id [ REAL ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] Please write me a SQL statement that answers the following question: Please list the official full names of all the current legislators who do not have an account on C-SPAN's video website. [/INST]
SELECT official_full_name FROM current WHERE cspan_id IS NULL OR cspan_id = '';
[INST] Here is a database schema: current : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] birthday_bio [ DATE ] cspan_id [ REAL ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ REAL ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ INTEGER ] votesmart_id [ REAL ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] Please write me a SQL statement that answers the following question: How many current legislators were born after the year 1960? [/INST]
SELECT COUNT(bioguide_id) FROM current WHERE birthday_bio >= '1961-01-01';
[INST] Here is a database schema: current : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] birthday_bio [ DATE ] cspan_id [ REAL ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ REAL ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ INTEGER ] votesmart_id [ REAL ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] Please write me a SQL statement that answers the following question: Among all the current female legislators, how many of them have not been registered in Federal Election Commission data? [/INST]
SELECT COUNT(*) FROM current WHERE (fec_id IS NULL OR fec_id = '') AND gender_bio = 'F';
[INST] Here is a database schema: current : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] birthday_bio [ DATE ] cspan_id [ REAL ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ REAL ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ INTEGER ] votesmart_id [ REAL ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] Please write me a SQL statement that answers the following question: What is the google entity ID of current legislator Sherrod Brown? [/INST]
SELECT google_entity_id_id FROM current WHERE official_full_name = 'Sherrod Brown';
[INST] Here is a database schema: current : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] birthday_bio [ DATE ] cspan_id [ REAL ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ REAL ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ INTEGER ] votesmart_id [ REAL ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] Please write me a SQL statement that answers the following question: Which current legislator is older, Sherrod Brown or Maria Cantwell? [/INST]
SELECT official_full_name FROM current WHERE official_full_name = 'Sherrod Brown' OR official_full_name = 'Maria Cantwell' ORDER BY birthday_bio LIMIT 1;
[INST] Here is a database schema: current : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] birthday_bio [ DATE ] cspan_id [ REAL ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ REAL ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ INTEGER ] votesmart_id [ REAL ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] Please write me a SQL statement that answers the following question: How many males were members of the current legislators? [/INST]
SELECT COUNT(*) FROM current WHERE gender_bio = 'M';
[INST] Here is a database schema: historical : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] primary_key bioguide_previous_id [ TEXT ] birthday_bio [ TEXT ] cspan_id [ TEXT ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_alternate_id [ TEXT ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ TEXT ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ TEXT ] votesmart_id [ TEXT ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] Please write me a SQL statement that answers the following question: How many females were members of the past legislators? [/INST]
SELECT COUNT(*) FROM historical WHERE gender_bio = 'F';
[INST] Here is a database schema: current : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] birthday_bio [ DATE ] cspan_id [ REAL ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ REAL ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ INTEGER ] votesmart_id [ REAL ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] Please write me a SQL statement that answers the following question: How many male legislators are Roman Catholic? [/INST]
SELECT COUNT(*) FROM current WHERE religion_bio = 'Roman Catholic' AND gender_bio = 'M';
[INST] Here is a database schema: current : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] birthday_bio [ DATE ] cspan_id [ REAL ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ REAL ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ INTEGER ] votesmart_id [ REAL ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] historical : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] primary_key bioguide_previous_id [ TEXT ] birthday_bio [ TEXT ] cspan_id [ TEXT ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_alternate_id [ TEXT ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ TEXT ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ TEXT ] votesmart_id [ TEXT ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] Please write me a SQL statement that answers the following question: Calculate the percentage of the total number of current female legislators and past female legislators. State which one has the highest value. [/INST]
SELECT CAST(COUNT(CASE WHEN current.gender_bio = 'F' THEN current.bioguide_id ELSE NULL END) AS REAL) * 100 / ( SELECT COUNT(CASE WHEN historical.gender_bio = 'F' THEN historical.bioguide_id ELSE NULL END) FROM historical ) FROM current;
[INST] Here is a database schema: historical : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] primary_key bioguide_previous_id [ TEXT ] birthday_bio [ TEXT ] cspan_id [ TEXT ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_alternate_id [ TEXT ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ TEXT ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ TEXT ] votesmart_id [ TEXT ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] Please write me a SQL statement that answers the following question: How many historical legislators were born in 1973? [/INST]
SELECT COUNT(*) FROM historical WHERE CAST(birthday_bio AS date) = 1973;
[INST] Here is a database schema: historical : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] primary_key bioguide_previous_id [ TEXT ] birthday_bio [ TEXT ] cspan_id [ TEXT ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_alternate_id [ TEXT ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ TEXT ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ TEXT ] votesmart_id [ TEXT ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] Please write me a SQL statement that answers the following question: What is the ratio of males and females among historical legislators? [/INST]
SELECT CAST(SUM(CASE WHEN gender_bio = 'M' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN gender_bio = 'F' THEN 1 ELSE 0 END) FROM historical;
[INST] Here is a database schema: current : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] birthday_bio [ DATE ] cspan_id [ REAL ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ REAL ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ INTEGER ] votesmart_id [ REAL ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] Please write me a SQL statement that answers the following question: List the official full names and genders of legislators who have Collins as their last name. [/INST]
SELECT official_full_name, gender_bio FROM current WHERE last_name = 'Collins';
[INST] Here is a database schema: current : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] birthday_bio [ DATE ] cspan_id [ REAL ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ REAL ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ INTEGER ] votesmart_id [ REAL ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] Please write me a SQL statement that answers the following question: What is the birthday of Amy Klobuchar? [/INST]
SELECT birthday_bio FROM current WHERE first_name = 'Amy' AND last_name = 'Klobuchar';
[INST] Here is a database schema: current : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] birthday_bio [ DATE ] cspan_id [ REAL ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ REAL ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ INTEGER ] votesmart_id [ REAL ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] Please write me a SQL statement that answers the following question: How many legislators have not been registered in Federal Election Commission data? [/INST]
SELECT COUNT(*) FROM current WHERE fec_id IS NULL OR fec_id = '';
[INST] Here is a database schema: current : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] birthday_bio [ DATE ] cspan_id [ REAL ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ REAL ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ INTEGER ] votesmart_id [ REAL ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] Please write me a SQL statement that answers the following question: State the number of female legislators in the list. [/INST]
SELECT COUNT(*) FROM current WHERE gender_bio = 'F';
[INST] Here is a database schema: current : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] birthday_bio [ DATE ] cspan_id [ REAL ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ REAL ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ INTEGER ] votesmart_id [ REAL ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] Please write me a SQL statement that answers the following question: Give the full name of legislators who have accounts on OpenSecrets.org. [/INST]
SELECT COUNT(*) FROM current WHERE opensecrets_id IS NOT NULL AND opensecrets_id <> '';
[INST] Here is a database schema: current : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] birthday_bio [ DATE ] cspan_id [ REAL ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ REAL ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ INTEGER ] votesmart_id [ REAL ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] Please write me a SQL statement that answers the following question: What is the middle name of the legislator whose birthday was on 8/24/1956? [/INST]
SELECT middle_name FROM current WHERE birthday_bio = '1956-08-24';
[INST] Here is a database schema: current : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] birthday_bio [ DATE ] cspan_id [ REAL ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ REAL ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ INTEGER ] votesmart_id [ REAL ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] Please write me a SQL statement that answers the following question: How many of the legislators are male? [/INST]
SELECT COUNT(*) FROM current WHERE gender_bio = 'M';
[INST] Here is a database schema: current : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] birthday_bio [ DATE ] cspan_id [ REAL ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ REAL ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ INTEGER ] votesmart_id [ REAL ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] Please write me a SQL statement that answers the following question: What is the total number of legislators with "John" as their first name? [/INST]
SELECT COUNT(*) FROM current WHERE first_name = 'John';
[INST] Here is a database schema: current : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] birthday_bio [ DATE ] cspan_id [ REAL ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ REAL ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ INTEGER ] votesmart_id [ REAL ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] Please write me a SQL statement that answers the following question: List the full name of legislators whose born in 1960. [/INST]
SELECT official_full_name FROM current WHERE birthday_bio LIKE '1960%';
[INST] Here is a database schema: historical : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] primary_key bioguide_previous_id [ TEXT ] birthday_bio [ TEXT ] cspan_id [ TEXT ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_alternate_id [ TEXT ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ TEXT ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ TEXT ] votesmart_id [ TEXT ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] Please write me a SQL statement that answers the following question: What is the google entity ID of Benjamin Hawkins? [/INST]
SELECT google_entity_id_id FROM historical WHERE first_name = 'Benjamin' AND last_name = 'Hawkins';
[INST] Here is a database schema: historical : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] primary_key bioguide_previous_id [ TEXT ] birthday_bio [ TEXT ] cspan_id [ TEXT ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_alternate_id [ TEXT ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ TEXT ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ TEXT ] votesmart_id [ TEXT ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] Please write me a SQL statement that answers the following question: What is the name of the legislator with the ID of W000059? [/INST]
SELECT first_name, last_name FROM historical WHERE bioguide_id = 'W000059';
[INST] Here is a database schema: historical : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] primary_key bioguide_previous_id [ TEXT ] birthday_bio [ TEXT ] cspan_id [ TEXT ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_alternate_id [ TEXT ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ TEXT ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ TEXT ] votesmart_id [ TEXT ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] Please write me a SQL statement that answers the following question: Does Thomas Carnes have an account on ballotpedia.org? [/INST]
SELECT CASE WHEN ballotpedia_id IS NULL THEN 'doesn''t have' ELSE 'have' END AS HaveorNot FROM historical WHERE first_name = 'Thomas' AND last_name = 'Carnes';
[INST] Here is a database schema: historical : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] primary_key bioguide_previous_id [ TEXT ] birthday_bio [ TEXT ] cspan_id [ TEXT ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_alternate_id [ TEXT ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ TEXT ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ TEXT ] votesmart_id [ TEXT ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] Please write me a SQL statement that answers the following question: How many legislators were born in 1736? [/INST]
SELECT COUNT(bioguide_id) FROM historical WHERE birthday_bio LIKE '1736%';
[INST] Here is a database schema: historical : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] primary_key bioguide_previous_id [ TEXT ] birthday_bio [ TEXT ] cspan_id [ TEXT ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_alternate_id [ TEXT ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ TEXT ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ TEXT ] votesmart_id [ TEXT ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] Please write me a SQL statement that answers the following question: Which legislators are woman? [/INST]
SELECT first_name, last_name FROM historical WHERE gender_bio = 'F';
[INST] Here is a database schema: historical : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] primary_key bioguide_previous_id [ TEXT ] birthday_bio [ TEXT ] cspan_id [ TEXT ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_alternate_id [ TEXT ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ TEXT ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ TEXT ] votesmart_id [ TEXT ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] Please write me a SQL statement that answers the following question: What is the ratio between male and female legislators? [/INST]
SELECT CAST(SUM(CASE WHEN gender_bio = 'M' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN gender_bio = 'F' THEN 1 ELSE 0 END) FROM historical;
[INST] Here is a database schema: historical : ballotpedia_id [ TEXT ] bioguide_id [ TEXT ] primary_key bioguide_previous_id [ TEXT ] birthday_bio [ TEXT ] cspan_id [ TEXT ] fec_id [ TEXT ] first_name [ TEXT ] gender_bio [ TEXT ] google_entity_id_id [ TEXT ] govtrack_id [ INTEGER ] house_history_alternate_id [ TEXT ] house_history_id [ REAL ] icpsr_id [ REAL ] last_name [ TEXT ] lis_id [ TEXT ] maplight_id [ TEXT ] middle_name [ TEXT ] nickname_name [ TEXT ] official_full_name [ TEXT ] opensecrets_id [ TEXT ] religion_bio [ TEXT ] suffix_name [ TEXT ] thomas_id [ TEXT ] votesmart_id [ TEXT ] wikidata_id [ TEXT ] wikipedia_id [ TEXT ] Please write me a SQL statement that answers the following question: Calculate the percentage of famous_legislatorss. [/INST]
SELECT CAST(SUM(CASE WHEN wikipedia_id IS NOT NULL THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(bioguide_id) FROM historical;