problem
stringlengths
121
422
db_id
stringclasses
69 values
solution
stringlengths
23
804
Write SQL query to solve given problem: Which movies had the main character named Donald Duck and who directed them?. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
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'
Write SQL query to solve given problem: Describe the hero, director, and the release date of Mulan.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
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'
Write SQL query to solve given problem: Provide the title, total gross, and MPAA rating of the movie which has a hero named Elsa.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
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'
Write SQL query to solve given problem: Provide the title, director, and release date of the movie voice-acted by Freddie Jones.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
SELECT T1.movie, T3.director, T2.release_date FROM `voice-actors` AS T1 INNER JOIN characters AS T2 ON T1.movie = T2.movie_title INNER JOIN director AS T3 ON T3.name = T2.movie_title WHERE T1.`voice-actor` = 'Freddie Jones'
Write SQL query to solve given problem: Among Frank Welker's voice-acted movies, list the movie titles and the total gross when the estimated inflation rate was less than 2.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
SELECT T1.movie_title, T1.total_gross FROM movies_total_gross AS T1 INNER JOIN `voice-actors` AS T2 ON T1.movie_title = T2.movie WHERE T2.`voice-actor` = 'Frank Welker' AND CAST(REPLACE(trim(T1.inflation_adjusted_gross, '$'), ',', '') AS REAL) * 1.0 / CAST(REPLACE(trim(T1.total_gross, '$'), ',', '') AS REAL) * 1.0 < 2
Write SQL query to solve given problem: Who directed the most popular movie?. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
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
Write SQL query to solve given problem: Describe the voice actors and villains in Cinderella.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
SELECT T1.`voice-actor`, T2.villian FROM `voice-actors` AS T1 INNER JOIN characters AS T2 ON T1.movie = T2.movie_title WHERE T2.movie_title = 'Cinderella'
Write SQL query to solve given problem: Who is the voice actor of the hero in Lion King?. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
SELECT T1.`voice-actor` FROM `voice-actors` AS T1 INNER JOIN characters AS T2 ON T1.movie = T2.movie_title WHERE T2.movie_title = 'Lion King' AND T1.character = 'Lion King'
Write SQL query to solve given problem: Provide the directors and MPAA ratings of the musical movies released in 1993.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
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'
Write SQL query to solve given problem: Among the movies released from 1991 to 2000, calculate the percentage of comedy movies. Provide any five movie titles and directors.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
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'
Write SQL query to solve given problem: 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.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
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
Write SQL query to solve given problem: Name the voice actor of the character Calliope in the movie Hercules.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
SELECT `voice-actor` FROM `voice-actors` WHERE movie = 'Hercules' AND character = 'Calliope'
Write SQL query to solve given problem: How many voice actors for the movie Aladdin?. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
SELECT COUNT('voice-actor') FROM `voice-actors` WHERE movie = 'Aladdin'
Write SQL query to solve given problem: List the movie titles with the voice actor Jeff Bennet. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
SELECT movie FROM `voice-actors` WHERE 'voice-actor' = 'Jeff Bennett'
Write SQL query to solve given problem: Provide the director's name of Wreck-It Ralph movie.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
SELECT director FROM director WHERE name = 'Wreck-It Ralph'
Write SQL query to solve given problem: What movies did director Jack Kinney direct?. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
SELECT name FROM director WHERE director = 'Jack Kinney'
Write SQL query to solve given problem: How many movies were released between 1937 and 1950?. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
SELECT COUNT(movie_title) FROM characters WHERE SUBSTR(release_date, LENGTH(release_date) - 1, LENGTH(release_date)) BETWEEN '37' AND '50'
Write SQL query to solve given problem: Provide the name of the song from the movie directed by Ben Sharpsteen.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
SELECT T1.song FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Ben Sharpsteen'
Write SQL query to solve given problem: Indicate the release date of the film The Lion King directed by Roger Allers.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
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'
Write SQL query to solve given problem: Name the villain of the movie with Scott Weinger and Brad Kane as voice actors.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
SELECT T1.villian FROM characters AS T1 INNER JOIN `voice-actors` AS T2 ON T1.movie_title = T2.movie WHERE T2.`voice-actor` = 'Scott Weinger Brad Kane'
Write SQL query to solve given problem: Which movies of director Wolfgang Reitherman do not have villain?. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
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
Write SQL query to solve given problem: List the titles of movies directed by Jack Kinney that were released before 1947.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
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'
Write SQL query to solve given problem: List the names of the directors whose films grossed over $100 million.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
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
Write SQL query to solve given problem: Which movie's song title has the highest total gross?. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
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
Write SQL query to solve given problem: Which director had the most popular film from 1937 to 1990?. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
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
Write SQL query to solve given problem: List all the main characters of the movie that are comedy genre.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
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'
Write SQL query to solve given problem: Provide the names of voice actors for the characters of films directed by Wolfgang Reitherman.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
SELECT T2.hero, T1.`voice-actor` FROM `voice-actors` AS T1 INNER JOIN characters AS T2 ON T1.movie = T2.movie_title INNER JOIN director AS T3 ON T3.name = T2.movie_title WHERE T3.director = 'Wolfgang Reitherman'
Write SQL query to solve given problem: What genre of movie has Taran as the main character?. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
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'
Write SQL query to solve given problem: The main character Elsa is voiced by which actor and who is the director of the movie?. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
SELECT T1.`voice-actor`, T3.director FROM `voice-actors` AS T1 INNER JOIN characters AS T2 ON T1.movie = T2.movie_title INNER JOIN director AS T3 ON T2.movie_title = T3.name WHERE T2.hero = 'Elsa'
Write SQL query to solve given problem: Calculate the percentage of directors whose films grossed over $100 million.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
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
Write SQL query to solve given problem: Calculate the percentage of voice actors whose main character in the movie is in the Drama genre.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
SELECT CAST(COUNT(CASE WHEN T1.genre = 'Drama' THEN T3.`voice-actor` ELSE NULL END) AS REAL) * 100 / COUNT(T3.`voice-actor`) FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title INNER JOIN `voice-actors` AS T3 ON T3.movie = T1.movie_title
Write SQL query to solve given problem: Name the first movie released by Disney.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
SELECT movie_title FROM characters ORDER BY SUBSTR(release_date, LENGTH(release_date) - 1, LENGTH(release_date)) ASC LIMIT 1
Write SQL query to solve given problem: How many movies were released by Disney between 2010 and 2016?. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
SELECT COUNT(movie_title) FROM characters WHERE SUBSTR(release_date, LENGTH(release_date) - 1, LENGTH(release_date)) BETWEEN '10' AND '16'
Write SQL query to solve given problem: Who was the first ever Disney villain?. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
SELECT villian FROM characters ORDER BY SUBSTR(release_date, LENGTH(release_date) - 1, LENGTH(release_date)) DESC LIMIT 1
Write SQL query to solve given problem: What is Disney's highest grossing action movie?. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
SELECT movie_title FROM movies_total_gross WHERE genre = 'Action' ORDER BY CAST(REPLACE(trim(total_gross, '$'), ',', '') AS REAL) DESC LIMIT 1
Write SQL query to solve given problem: Which actor voices Akela from The Jungle Book?. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
SELECT `voice-actor` FROM `voice-actors` WHERE character = 'Akela'
Write SQL query to solve given problem: Determine Disney's total box office gross between 2010 and 2016.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
SELECT SUM(Total) FROM revenue WHERE `Year` BETWEEN 2010 AND 2016
Write SQL query to solve given problem: Name the main character of Disney's most popular adventure movie based on its inflation-adjusted gross.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
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
Write SQL query to solve given problem: Name the director of Disney's lowest grossing movie.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
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
Write SQL query to solve given problem: Find out what proportion of total revenue Walt Disney Parks and Resorts received in 2010.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
SELECT SUM(`Walt Disney Parks and Resorts`) / SUM(Total) * 100 FROM revenue WHERE year = 2010
Write SQL query to solve given problem: Determine the average gross for Disney's PG-13-rated action movies.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
SELECT SUM(CAST(REPLACE(trim(total_gross, '$'), ',', '') AS REAL)) / COUNT(movie_title) FROM movies_total_gross WHERE MPAA_rating = 'PG-13'
Write SQL query to solve given problem: How many voice-actors were involved in the Bambi movie?. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
SELECT COUNT(DISTINCT 'voice-actor') FROM `voice-actors` WHERE movie = 'Bambi'
Write SQL query to solve given problem: Find the estimated inflation rate that was used to adjust the 1995 box office revenue for Disney's films.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
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'
Write SQL query to solve given problem: What is the difference in the current gross of Cars and its sequel, Cars 2? Which movie is more popular?. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
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
Write SQL query to solve given problem: 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.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
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'
Write SQL query to solve given problem: Name actors who voiced more than five Disney characters.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
SELECT 'voice-actor' FROM `voice-actors` GROUP BY 'voice-actor' HAVING COUNT(movie) > 5
Write SQL query to solve given problem: Name the top 5 highest-grossing Disney movies adjusted for inflation. Identify the percentage they contributed to the total of Disney's current gross.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
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
Write SQL query to solve given problem: Among all Disney movies directed by Gary Trousdale, determine the percentage that earned over USD100m based on actual grossing.. Keep the solution inside sql tag ```sql [SQL-Query] ```
disney
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'
Write SQL query to solve given problem: How many current legislators do not have an account on ballotpedia.org ?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT COUNT(*) FROM current WHERE ballotpedia_id = '' OR ballotpedia_id IS NULL
Write SQL query to solve given problem: Please list the official full names of all the current legislators who do not have an account on C-SPAN's video website.. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT official_full_name FROM current WHERE cspan_id IS NULL OR cspan_id = ''
Write SQL query to solve given problem: How many current legislators were born after the year 1960?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT COUNT(bioguide_id) FROM current WHERE birthday_bio >= '1961-01-01'
Write SQL query to solve given problem: Among all the current female legislators, how many of them have not been registered in Federal Election Commission data?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT COUNT(*) FROM current WHERE (fec_id IS NULL OR fec_id = '') AND gender_bio = 'F'
Write SQL query to solve given problem: What is the google entity ID of current legislator Sherrod Brown?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT google_entity_id_id FROM current WHERE official_full_name = 'Sherrod Brown'
Write SQL query to solve given problem: Which current legislator is older, Sherrod Brown or Maria Cantwell?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT official_full_name FROM current WHERE official_full_name = 'Sherrod Brown' OR official_full_name = 'Maria Cantwell' ORDER BY birthday_bio LIMIT 1
Write SQL query to solve given problem: What is the username of the current official Facebook presence of current legislator Todd Young?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT T1.facebook FROM `social-media` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.official_full_name = 'Todd Young'
Write SQL query to solve given problem: How many current legislators do not have an account on instagram?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT COUNT(*) FROM `social-media` AS T1 INNER JOIN current AS T2 ON T1.bioguide = T2.bioguide_id WHERE T1.instagram IS NULL
Write SQL query to solve given problem: To which current legislator does twitter ID234128524 belong? Please give his or her full official name.. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT T1.official_full_name FROM current AS T1 INNER JOIN `social-media` AS T2 ON T2.bioguide = T1.bioguide_id WHERE T2.twitter_id = 234128524
Write SQL query to solve given problem: Please list the current official YouTube usernames of all the current female legislators.. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT T2.youtube FROM current AS T1 INNER JOIN `social-media` AS T2 ON T2.bioguide = T1.bioguide_id WHERE T1.gender_bio = 'F'
Write SQL query to solve given problem: What is the username of the current official Facebook presence of the oldest current legislator?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT T2.facebook FROM current AS T1 INNER JOIN `social-media` AS T2 ON T2.bioguide = T1.bioguide_id ORDER BY T1.birthday_bio LIMIT 1
Write SQL query to solve given problem: Among the current legislators who do not have accounts on OpenSecrets.org., how many of them do not have instagram accounts either?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT SUM(CASE WHEN T1.instagram IS NULL THEN 1 ELSE 0 END) AS count FROM `social-media` AS T1 INNER JOIN current AS T2 ON T1.bioguide = T2.bioguide_id WHERE T2.opensecrets_id IS NULL OR T2.opensecrets_id = ''
Write SQL query to solve given problem: Current legislator Roger F. Wicker has not been a representative for how many terms?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT SUM(CASE WHEN T1.official_full_name = 'Roger F. Wicker' THEN 1 ELSE 0 END) AS count FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.district IS NULL OR T2.district = ''
Write SQL query to solve given problem: For how many terms has current legislator Sherrod Brown served?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT COUNT(*) FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.official_full_name = 'Sherrod Brown'
Write SQL query to solve given problem: Please list the official full names of all the current legislators who were once a senator during his or her terms.. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT T2.official_full_name FROM `current-terms` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T1.state_rank IS NOT NULL
Write SQL query to solve given problem: For which state did current legislator Sherrod Brown serve during his term that started on 1993/1/5?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT T1.state FROM `current-terms` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T1.start = '1993-01-05' AND T2.official_full_name = 'Sherrod Brown'
Write SQL query to solve given problem: Among all the female current legislators, how many of them have served for more than 4 terms?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT COUNT(CID) FROM ( SELECT T1.bioguide_id AS CID FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.gender_bio = 'F' GROUP BY T2.bioguide HAVING COUNT(T2.bioguide) > 4 )
Write SQL query to solve given problem: Among the current legislators who have served for more than 6 terms, how many of them were born after 1960?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT COUNT(CID) FROM ( SELECT T1.bioguide_id AS CID FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.birthday_bio >= '1960-01-01' GROUP BY T2.bioguide HAVING COUNT(T2.bioguide) > 6 )
Write SQL query to solve given problem: What is the average number of terms for a current female legislator?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT CAST(COUNT(T2.bioguide) AS REAL) / COUNT(DISTINCT T1.bioguide_id) FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.gender_bio = 'F'
Write SQL query to solve given problem: Among all the current legislators whose religion is Roman Catholic, what is the percentage of the ones without an instagram account?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT CAST(SUM(CASE WHEN T1.instagram IS NULL THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM `social-media` AS T1 INNER JOIN current AS T2 ON T1.bioguide = T2.bioguide_id WHERE T2.religion_bio = 'Roman Catholic'
Write SQL query to solve given problem: How many males were members of the current legislators?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT COUNT(*) FROM current WHERE gender_bio = 'M'
Write SQL query to solve given problem: How many current legislators chose Republican as their political party?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT COUNT(*) FROM `current-terms` WHERE party = 'Republican'
Write SQL query to solve given problem: How many legislators have an Instagram account?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT COUNT(*) FROM `social-media` WHERE instagram IS NOT NULL AND instagram <> ''
Write SQL query to solve given problem: How many females were members of the past legislators?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT COUNT(*) FROM historical WHERE gender_bio = 'F'
Write SQL query to solve given problem: How many male legislators are Roman Catholic?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT COUNT(*) FROM current WHERE religion_bio = 'Roman Catholic' AND gender_bio = 'M'
Write SQL query to solve given problem: What type of political party Sherrod Brown has in 2005?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT T1.party FROM `current-terms` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.first_name = 'Sherrod' AND T2.last_name = 'Brown' AND T1.start LIKE '%2005%'
Write SQL query to solve given problem: List the full name of all the senior senators in year 2013.. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT T2.official_full_name FROM `current-terms` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T1.state_rank = 'senior' AND T1.type = 'sen' AND T1.start LIKE '2013%'
Write SQL query to solve given problem: What is the current official Youtube username of Chris Van Hollen?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT T2.youtube FROM current AS T1 INNER JOIN `social-media` AS T2 ON T2.bioguide = T1.bioguide_id WHERE T1.official_full_name = 'Chris Van Hollen'
Write SQL query to solve given problem: How many official social media does Mark Warner have?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT CASE WHEN T1.facebook IS NOT NULL THEN 1 END + CASE WHEN T1.instagram IS NOT NULL THEN 1 END + CASE WHEN T1.twitter IS NOT NULL THEN 1 END + CASE WHEN T1.youtube IS NOT NULL THEN 1 END AS COUNTSOCIAL FROM `social-media` AS T1 INNER JOIN current AS T2 ON T1.bioguide = T2.bioguide_id WHERE T2.first_name = 'Mark' AND T2.last_name = 'Warner'
Write SQL query to solve given problem: List the last name of all current legislators who live in California.. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT T1.last_name FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.state = 'CA' GROUP BY T1.last_name
Write SQL query to solve given problem: List the full name of all current female senators.. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT T2.first_name, T2.last_name FROM `current-terms` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T1.type = 'sen' AND T2.gender_bio = 'F' GROUP BY T2.ballotpedia_id
Write SQL query to solve given problem: What is the numeric ID of Chris Van Hollen on GovTrack.us?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT T2.govtrack FROM current AS T1 INNER JOIN `social-media` AS T2 ON T2.bioguide = T1.bioguide_id WHERE T1.official_full_name = 'Chris Van Hollen'
Write SQL query to solve given problem: What is the current official Twitter handle of Roger F. Wicker?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT T2.twitter FROM current AS T1 INNER JOIN `social-media` AS T2 ON T2.bioguide = T1.bioguide_id WHERE T1.official_full_name = 'Roger F. Wicker'
Write SQL query to solve given problem: List the full name of all past legislators that chose Pro-Administration as their political party in year 1791.. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT T1.first_name, T1.last_name FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.party = 'Pro-Administration' AND CAST(T2.start AS DATE) <= 1791 AND CAST(T2.END AS DATE) >= 1791
Write SQL query to solve given problem: Provide the full name of all current female legislators that chose Republican as their political party.. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT T1.first_name, T1.last_name FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.party = 'Republican' AND T1.gender_bio = 'F' AND T2.END > DATE() GROUP BY T1.bioguide_id
Write SQL query to solve given problem: What is the district number that Chris Van Hollen serving?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT T2.district FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.official_full_name = 'Chris Van Hollen' AND T2.district IS NOT NULL GROUP BY T2.district
Write SQL query to solve given problem: How many times did Richard Durbin become a legislator in district 20?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT SUM(CASE WHEN T2.district = 20 THEN 1 ELSE 0 END) AS count FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.first_name = 'Richard' AND T1.last_name = 'Durbin'
Write SQL query to solve given problem: Calculate the average number of current male legislators who chose Democrat from 2000 until 2021.. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT CAST(COUNT(T1.bioguide_id) AS REAL) / 22 FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.gender_bio = 'M' AND CAST(T2.start AS DATE) >= 2000 AND CAST(T2.END AS DATE) <= 2021 AND T2.party = 'Democrat'
Write SQL query to solve given problem: Calculate the percentage of the total number of current female legislators and past female legislators. State which one has the highest value.. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
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
Write SQL query to solve given problem: Give the YouTube ID of the channel 'RepWassermanSchultz.'. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT youtube_id FROM `social-media` WHERE youtube = 'RepWassermanSchultz'
Write SQL query to solve given problem: What are the Facebook, Twitter and YouTube usernames of Adam Kinzinger?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT T2.facebook FROM current AS T1 INNER JOIN `social-media` AS T2 ON T2.bioguide = T1.bioguide_id WHERE T1.official_full_name = 'Adam Kinzinger'
Write SQL query to solve given problem: Which party does Christopher Henderson Clark belong to?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT T1.party FROM `historical-terms` AS T1 INNER JOIN historical AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.first_name OR T2.middle_name OR T2.last_name = 'ChristopherHendersonClark'
Write SQL query to solve given problem: List the official full names of 10 legislators who have a YouTube account but no Instagram account.. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT T2.official_full_name FROM `social-media` AS T1 INNER JOIN current AS T2 ON T1.bioguide = T2.bioguide_id WHERE T1.facebook IS NOT NULL AND (T1.instagram IS NULL OR T1.instagram = '') LIMIT 10
Write SQL query to solve given problem: Give the official full names of legislators representing Virginia.. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT T1.official_full_name FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.state = 'VA' GROUP BY T1.official_full_name
Write SQL query to solve given problem: Which historical legislators are members of the National Greenbacker party? Write their first and last names.. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT T2.first_name, T2.last_name FROM `historical-terms` AS T1 INNER JOIN historical AS T2 ON T2.bioguide_id = T1.bioguide WHERE T1.party = 'National Greenbacker'
Write SQL query to solve given problem: Which legislator has the YouTube channel 'RoskamIL06?' Write the official full name.. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT T1.official_full_name FROM current AS T1 INNER JOIN `social-media` AS T2 ON T2.bioguide = T1.bioguide_id WHERE T2.youtube = 'RoskamIL06'
Write SQL query to solve given problem: List the full names of 10 legislators who only have a Facebook account.. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT T2.official_full_name FROM `social-media` AS T1 INNER JOIN current AS T2 ON T1.bioguide = T2.bioguide_id WHERE (T1.youtube IS NULL OR T1.youtube = '') AND (T1.instagram IS NULL OR T1.instagram = '') AND (T1.twitter IS NULL OR T1.twitter = '') AND T1.facebook IS NOT NULL AND T1.facebook != ''
Write SQL query to solve given problem: Write the full names of junior ranked Republicans.. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT T1.official_full_name FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.party = 'Republican' AND T2.state_rank = 'junior' GROUP BY T1.official_full_name
Write SQL query to solve given problem: What is the contact URL of Claire McCaskill?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT T2.contact_form FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.official_full_name = 'Claire McCaskill' GROUP BY T2.contact_form
Write SQL query to solve given problem: Give the Wikipedia IDs of historical legislators who are Readjuster Democrats.. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT T2.wikipedia_id FROM `historical-terms` AS T1 INNER JOIN historical AS T2 ON T2.bioguide_id = T1.bioguide WHERE T1.party = 'Readjuster Democrat'
Write SQL query to solve given problem: List the full names of Republican legislators who have a nickname.. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT T1.official_full_name FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.party = 'Republican' AND T1.nickname_name IS NOT NULL GROUP BY T1.official_full_name
Write SQL query to solve given problem: Which state did Veronica Grace Boland represent and which party is she affiliated?. Keep the solution inside sql tag ```sql [SQL-Query] ```
legislator
SELECT T2.state, T2.party FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.first_name OR T1.middle_name OR T1.last_name = 'VeronicaGraceBoland'