problem
stringlengths 121
422
| db_id
stringclasses 69
values | solution
stringlengths 23
804
|
---|---|---|
Write SQL query to solve given problem: How many historical legislators were born in 1973?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT COUNT(*) FROM historical WHERE CAST(birthday_bio AS date) = 1973 |
Write SQL query to solve given problem: What is the ratio of males and females among historical legislators?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | 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 |
Write SQL query to solve given problem: Among the legislators who will end in 2009, how many are from the Republican party?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT `END`, party FROM `current-terms` WHERE STRFTIME('%Y', `END`) = '2009' AND party = 'Republican' |
Write SQL query to solve given problem: List the official full names and genders of legislators who have Collins as their last name.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT official_full_name, gender_bio FROM current WHERE last_name = 'Collins' |
Write SQL query to solve given problem: How many percent of senators were from class 1?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT CAST(SUM(CASE WHEN class = 1 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM `historical-terms` WHERE type = 'sen' |
Write SQL query to solve given problem: Provide the current legislators' official full names who are from the Independent party.. 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 = 'Independent' GROUP BY T1.official_full_name |
Write SQL query to solve given problem: How many years had Jr. John Conyers served in total?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT SUM(CAST(T2.END - T2.start AS DATE)) AS sum FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.official_full_name = 'John Conyers, Jr.' |
Write SQL query to solve given problem: How old was Jr. F. James Sensenbrenner when he first started as a legislator?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT CAST(MIN(T2.start) - T1.birthday_bio AS DATE) AS AGE FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.official_full_name = 'F. James Sensenbrenner, Jr.' |
Write SQL query to solve given problem: List the full names, religions, and parties of legislators who have served in Maine.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T1.official_full_name, T2.relation, T2.party FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.state = 'ME' GROUP BY T1.official_full_name, T2.relation, T2.party |
Write SQL query to solve given problem: Among legislators who have an Instagram account, list down their full names and nicknames who have a Thomas ID of less than 1000.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T1.official_full_name, T1.nickname_name FROM current AS T1 INNER JOIN `social-media` AS T2 ON T2.bioguide = T1.bioguide_id WHERE T2.instagram IS NOT NULL AND T1.thomas_id < 1000 |
Write SQL query to solve given problem: When was the last serving date of Matt Salmon?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T1.END FROM `historical-terms` AS T1 INNER JOIN historical AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.official_full_name = 'Matt Salmon' |
Write SQL query to solve given problem: Among the legislators who have served in the U.S. House, provide the party and the state of the legislators who were born in 1738.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T1.party, T1.state FROM `historical-terms` AS T1 INNER JOIN historical AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.house_history_id IS NOT NULL AND T2.birthday_bio LIKE '%1738%' |
Write SQL query to solve given problem: List the IDs and full names of legislators from the Liberal Republican party.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T2.bioguide_id, 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 = 'Liberal Republican' |
Write SQL query to solve given problem: Among the legislators who started a term on 2nd December 1793, how many of them were males?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT COUNT(T1.bioguide_id) FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.gender_bio = 'M' AND T2.start = '1793-12-02' |
Write SQL query to solve given problem: Compare the number of legislators who started the term in 1875 and 2005.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT SUM(CASE WHEN `current-terms`.start LIKE '2005%' THEN 1 ELSE 0 END) - ( SELECT SUM(CASE WHEN start LIKE '1875%' THEN 1 ELSE 0 END) FROM `historical-terms` ) FROM `current-terms` |
Write SQL query to solve given problem: List the full names, Twitter IDs, and YouTube IDs of legislators who have Richard as their first name.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T2.official_full_name, T1.twitter_id, T1.youtube_id FROM `social-media` AS T1 INNER JOIN current AS T2 ON T1.bioguide = T2.bioguide_id WHERE T2.first_name = 'Richard' |
Write SQL query to solve given problem: Provide the start date, end date, and party of Pearl Peden Oldfield.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T2.start, T2.`end`, T2.party FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.first_name = 'Pearl' AND T1.middle_name = 'Peden' AND T1.last_name = 'Oldfield' |
Write SQL query to solve given problem: What is the birthday of Amy Klobuchar?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT birthday_bio FROM current WHERE first_name = 'Amy' AND last_name = 'Klobuchar' |
Write SQL query to solve given problem: How many legislators 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 = '' |
Write SQL query to solve given problem: State the number of female legislators in the list.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT COUNT(*) FROM current WHERE gender_bio = 'F' |
Write SQL query to solve given problem: Give the full name of legislators who have accounts on OpenSecrets.org.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT COUNT(*) FROM current WHERE opensecrets_id IS NOT NULL AND opensecrets_id <> '' |
Write SQL query to solve given problem: What is the middle name of the legislator whose birthday was on 8/24/1956?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT middle_name FROM current WHERE birthday_bio = '1956-08-24' |
Write SQL query to solve given problem: How many legislators hold the title "Majority Leader"?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT COUNT(bioguide) FROM `current-terms` WHERE title = 'Majority Leader' |
Write SQL query to solve given problem: What is the title of legislator whose birthday on 2/20/1942?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T2.title FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.birthday_bio = '1942-02-20' GROUP BY T2.title |
Write SQL query to solve given problem: What is the gender of the legislator whose address at 317 Russell Senate Office Building Washington DC 20510?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T1.gender_bio FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.address = '317 Russell Senate Office Building Washington DC 20510' |
Write SQL query to solve given problem: List out the first name of legislators who are senior Senator.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T1.first_name FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.state_rank = 'senior' GROUP BY T1.first_name |
Write SQL query to solve given problem: Among male legislators, state number of the legislators who are not the senator.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT COUNT(T3.state) FROM ( SELECT T2.state FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.gender_bio = 'M' AND (T2.class IS NULL OR T2.class = '') GROUP BY T2.state ) T3 |
Write SQL query to solve given problem: Calculate the percentage of legislators who are Senator and were born in 1964.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT CAST(SUM(CASE WHEN T2.class IS NOT NULL THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.birthday_bio LIKE '%1964%' |
Write SQL query to solve given problem: Calculate the percentage of legislators who are not Senator and were born before 1975.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT CAST(COUNT(CASE WHEN T2.class IS NULL THEN T1.bioguide_id ELSE NULL END) AS REAL) * 100 / COUNT(T1.bioguide_id) FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE CAST(T1.birthday_bio AS DATE) <= 1975 |
Write SQL query to solve given problem: What is the twitter name of the legislator whose birthday was on 5/27/1946?. 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.birthday_bio = '1946-05-27' |
Write SQL query to solve given problem: State the opensecrets_id of the legislator whose YouTube name is Bluetkemeyer.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T1.opensecrets_id FROM current AS T1 INNER JOIN `social-media` AS T2 ON T2.bioguide = T1.bioguide_id WHERE T2.youtube = 'BLuetkemeyer' |
Write SQL query to solve given problem: Mention the username of Facebook of Ralph Abraham.. 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.first_name = 'Ralph' AND T1.last_name = 'Abraham' |
Write SQL query to solve given problem: What is the first name of the legislator whose address at 1005 Longworth HOB; Washington DC 20515-1408?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T1.first_name FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.address = '1005 Longworth HOB Washington DC 20515-1408' GROUP BY T1.first_name |
Write SQL query to solve given problem: What is the Instagram name of the legislator whose birthday was on 8/24/1952?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T1.instagram FROM `social-media` AS T1 INNER JOIN current AS T2 ON T1.bioguide = T2.bioguide_id WHERE T2.birthday_bio = '1952-08-24' |
Write SQL query to solve given problem: State number of legislators who are not the senator among female legislators.. 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.gender_bio = 'F' AND (T2.class IS NULL OR T2.class = '') |
Write SQL query to solve given problem: Give the religion of the legislator whose YouTube name is MaxineWaters.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T2.religion_bio FROM `social-media` AS T1 INNER JOIN current AS T2 ON T1.bioguide = T2.bioguide_id WHERE T1.youtube = 'MaxineWaters' |
Write SQL query to solve given problem: How many minority leaders have not been registered in Federal Election Commission data?. 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 T2.title = 'Minority Leader' AND (T1.fec_id IS NULL OR T1.fec_id = '') |
Write SQL query to solve given problem: How many of the legislators are male?. 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: Provide the facebook ID of the facebook account named "RepWilson".. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT facebook_id FROM `social-media` WHERE facebook = 'RepWilson' |
Write SQL query to solve given problem: What is the total number of legislators with "John" as their first name?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT COUNT(*) FROM current WHERE first_name = 'John' |
Write SQL query to solve given problem: Give the district numbers with an Anti-Administration party.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT district FROM `historical-terms` WHERE party = 'Anti-Administration' GROUP BY district |
Write SQL query to solve given problem: List the full name of legislators whose born in 1960.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT official_full_name FROM current WHERE birthday_bio LIKE '1960%' |
Write SQL query to solve given problem: What is the google entity ID of Benjamin Hawkins?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT google_entity_id_id FROM historical WHERE first_name = 'Benjamin' AND last_name = 'Hawkins' |
Write SQL query to solve given problem: Who is the Pro-Administration senator that runs from March 4, 1789 to December 31, 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 T2.start = '1789-03-04' AND T2.end = '1791-12-31' |
Write SQL query to solve given problem: What are the first and last name of the representatives of the house in district 9?. 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.district = 9 |
Write SQL query to solve given problem: Give the full name of the legislators with an independent party.. 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 = 'Independent' GROUP BY T1.official_full_name |
Write SQL query to solve given problem: List down the open secrets and thomas ID of the democrat senators of New Jersey.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T1.opensecrets_id, T1.thomas_id FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.type = 'sen' AND T2.state = 'NJ' GROUP BY T1.opensecrets_id, T1.thomas_id |
Write SQL query to solve given problem: Provide the google entity ID of the senators in New York.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T1.google_entity_id_id FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.type = 'sen' AND T2.state = 'NY' |
Write SQL query to solve given problem: Give the religion of the legislator with RSS url of http://www.corker.senate.gov/public/index.cfm/rss/feed.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T1.religion_bio FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.rss_url = 'http://www.corker.senate.gov/public/index.cfm/rss/feed' GROUP BY T1.religion_bio |
Write SQL query to solve given problem: What is the party of the legislator named Susan M. Collins?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T2.party FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.official_full_name = 'Susan M. Collins' GROUP BY T2.party |
Write SQL query to solve given problem: List down the district number of the representative of the house named Jonathan Grout.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T2.district FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.last_name = 'Grout' AND T1.first_name = 'Jonathan' AND T2.type = 'rep' |
Write SQL query to solve given problem: What is the party and state of the legislator that has an open secrets ID of N00003689 and thomas ID of 186?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T2.party, T2.state FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.opensecrets_id = 'N00003689' AND T1.thomas_id = 186 GROUP BY T2.party, T2.state |
Write SQL query to solve given problem: Provide the full name and birth date of the legislator with a contact form of http://www.brown.senate.gov/contact/.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T1.official_full_name, T1.birthday_bio FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.contact_form = 'http://www.brown.senate.gov/contact/' |
Write SQL query to solve given problem: Give the state and type of term of the legislator with the google entity ID of kg:/m/02pyzk.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T2.state, T2.type FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.google_entity_id_id = 'kg:/m/02pyzk' |
Write SQL query to solve given problem: Provide the type and end date of the term of the legislator named John Vining.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T2.type, T2.end FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.first_name = 'John' AND T1.last_name = 'Vining' |
Write SQL query to solve given problem: Find the difference between the number of female senators and representatives born between 1930 to 1970.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT SUM(CASE WHEN T2.type = 'sen' THEN 1 ELSE 0 END) - SUM(CASE WHEN T2.type = 'rep' THEN 1 ELSE 0 END) FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.gender_bio = 'F' AND strftime('%Y', T1.birthday_bio) BETWEEN '1930' AND '1970' |
Write SQL query to solve given problem: Among the male legislators born between 1955 to 1965, what is the percentage of the legislators with an independent party?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT CAST(SUM(CASE WHEN T2.party = 'Independent' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.party) FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.gender_bio = 'M' AND strftime('%Y', T1.birthday_bio) BETWEEN '1955' AND '1965' |
Write SQL query to solve given problem: What is the name of the legislator with the ID of W000059?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT first_name, last_name FROM historical WHERE bioguide_id = 'W000059' |
Write SQL query to solve given problem: Does Thomas Carnes have an account on ballotpedia.org?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | 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' |
Write SQL query to solve given problem: How many legislators were born in 1736?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT COUNT(bioguide_id) FROM historical WHERE birthday_bio LIKE '1736%' |
Write SQL query to solve given problem: Which legislators are woman?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT first_name, last_name FROM historical WHERE gender_bio = 'F' |
Write SQL query to solve given problem: How many districts are in Idaho?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT COUNT(district) FROM `current-terms` WHERE state = 'ID' |
Write SQL query to solve given problem: How many legislators are not senator?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT COUNT(bioguide) FROM `current-terms` WHERE class IS NULL |
Write SQL query to solve given problem: What is the ratio between male and female legislators?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | 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 |
Write SQL query to solve given problem: Calculate the percentage of famous_legislatorss.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT CAST(SUM(CASE WHEN wikipedia_id IS NOT NULL THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(bioguide_id) FROM historical |
Write SQL query to solve given problem: Which legislators do not have instagram account?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T1.first_name, T1.last_name FROM current AS T1 INNER JOIN `social-media` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.instagram IS NULL |
Write SQL query to solve given problem: List all the representatives in 1789 along with the districts and state.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T2.district, T2.state FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.start LIKE '1789%' |
Write SQL query to solve given problem: State all the district that Benjamin Contee has served before.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T2.district FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.first_name = 'Benjamin' AND T1.last_name = 'Contee' |
Write SQL query to solve given problem: State the address of Amy Klobuchar at the term of 4th of January 2001.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T2.address FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.first_name = 'Amy' AND T1.last_name = 'Klobuchar' AND T2.start = '2001-04-01' |
Write SQL query to solve given problem: List all the junior senators in 1997.. 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.start LIKE '1997%' AND T2.state_rank = 'junior' |
Write SQL query to solve given problem: How many female legislators become representatives for California in 2015?. 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 STRFTIME('%Y', T2.start) = '2015' AND T2.state = 'CA' AND T1.gender_bio = 'F' |
Write SQL query to solve given problem: What is the Twitter ID of Emanuel Cleaver?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T1.twitter_id FROM `social-media` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.first_name = 'Emanuel' AND T2.last_name = 'Cleaver' |
Write SQL query to solve given problem: State all the Facebook ID for current legislators under the democrat party.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T2.facebook_id FROM `current-terms` AS T1 INNER JOIN `social-media` AS T2 ON T1.bioguide = T2.bioguide WHERE T1.party = 'Democrat' GROUP BY T2.facebook_id |
Write SQL query to solve given problem: Which historical female legislator that have their term ended on the 3rd of March 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.end = '1791-03-03' AND T1.gender_bio = 'F' |
Write SQL query to solve given problem: List all the Jewish current legislators that had served in Florida.. 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 T1.religion_bio = 'Jewish' AND T2.state = 'FL' GROUP BY T1.first_name, T1.last_name |
Write SQL query to solve given problem: What is the ratio between famous current legislators and famous historical legislators?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT CAST(COUNT(CASE WHEN wikipedia_id IS NOT NULL THEN bioguide_id ELSE 0 END) AS REAL) * 100 / ( SELECT COUNT(CASE WHEN wikipedia_id IS NOT NULL THEN bioguide_id ELSE 0 END) FROM historical ) FROM current |
Write SQL query to solve given problem: Based on the number of current legislators, calculate the percentage of legislators that served in 21st-Century.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT CAST(SUM(CASE WHEN strftime('%Y', T2.start) BETWEEN '2000' AND '2017' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.bioguide_id) FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide |
Write SQL query to solve given problem: How many Catholic legislators do not have an account on ballotpedia.org?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT COUNT(bioguide_id) FROM historical WHERE religion_bio = 'Catholic' AND ballotpedia_id IS NULL |
Write SQL query to solve given problem: How many class 1 senators belong to the Republican party?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT COUNT(bioguide) FROM `current-terms` WHERE class = 1 AND party = 'Republican' |
Write SQL query to solve given problem: What are the full names of the non-google female entity legislators that have not been registered in Federal Election Commission data?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT first_name, last_name FROM historical WHERE gender_bio = 'F' AND google_entity_id_id IS NULL AND fec_id IS NULL |
Write SQL query to solve given problem: In California, how many representatives ended their term in 1995?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT COUNT(*) FROM `current-terms` WHERE state = 'CA' AND type = 'rep' AND end LIKE '1995%' |
Write SQL query to solve given problem: What is the full name of the oldest legislator?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT first_name, last_name FROM historical ORDER BY birthday_bio LIMIT 1 |
Write SQL query to solve given problem: List all of the ids of the representatives belonging to the Democrat party in district 13 that ended their term on 1/3/2019?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT bioguide FROM `current-terms` WHERE type = 'rep' AND party = 'Democrat' AND end = '2019-01-03' AND district = 13 |
Write SQL query to solve given problem: What is the official Twitter handle of Jason Lewis?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T2.twitter FROM current AS T1 INNER JOIN `social-media` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.official_full_name = 'Jason Lewis' |
Write SQL query to solve given problem: Among the Independent senators that started their term in 2011 and onwards, what are the official full names of the senators that caucused with the Democrat?. 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 = 'Independent' AND strftime('%Y', T2.start) >= '2011' AND T2.type = 'sen' AND T2.caucus = 'Democrat' |
Write SQL query to solve given problem: How many Jewish legislators do not have facebook?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT COUNT(T3.bioguide_id) FROM ( SELECT T1.bioguide_id FROM current AS T1 INNER JOIN `social-media` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.facebook IS NULL GROUP BY T1.bioguide_id ) T3 |
Write SQL query to solve given problem: Which party has the highest number of legislators who are Baptist?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T2.party FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.religion_bio = 'Baptist' GROUP BY T2.party ORDER BY COUNT(T2.party) DESC LIMIT 1 |
Write SQL query to solve given problem: List the official full names of all the legislators who have facebook, instagram, twitter and youtube accounts.. 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 T1.bioguide_id = T2.bioguide WHERE T2.facebook IS NOT NULL AND T2.instagram IS NOT NULL AND T2.twitter IS NOT NULL AND T2.youtube IS NOT NULL |
Write SQL query to solve given problem: How many districts did John Conyers, Jr. serve in total?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT COUNT(T3.district) FROM ( SELECT T2.district FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.official_full_name = 'John Conyers, Jr.' GROUP BY T2.district ) T3 |
Write SQL query to solve given problem: What are the Wikipedia page names of all the anti-administration senators?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT T1.wikipedia_id FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.type = 'sen' AND T2.party = 'Anti-Administration' |
Write SQL query to solve given problem: List the official full names of all the legislators that served 13 district for 26 consecutive years.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT DISTINCT CASE WHEN SUM(CAST(strftime('%Y', T2.end) AS int) - CAST(strftime('%Y', T2.start) AS int)) = 26 THEN T1.official_full_name END FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide GROUP BY T1.official_full_name, T2.district HAVING COUNT(T1.official_full_name) = 13 |
Write SQL query to solve given problem: How many Federalist representatives are there whose first names are Benjamin?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT COUNT(T.bioguide_id) FROM ( SELECT T1.bioguide_id FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.first_name = 'Benjamin' AND T2.party = 'Federalist' AND T2.type = 'rep' GROUP BY T1.bioguide_id ) AS T |
Write SQL query to solve given problem: How many female representatives served in the state of California for at least 10 years?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT SUM(T3.result) FROM ( SELECT CASE WHEN SUM(CAST(strftime('%Y', T2.`end`) AS int) - CAST(strftime('%Y', T2.start) AS int)) > 10 THEN 1 ELSE 0 END AS result FROM current AS T1 INNER JOIN "current-terms" AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.gender_bio = 'F' AND T2.state = 'CA' AND T2.type = 'rep' ) AS T3 |
Write SQL query to solve given problem: What is the party of the oldest legislator?. 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 ORDER BY T2.birthday_bio LIMIT 1 |
Write SQL query to solve given problem: Who is the Lutheran representative that served in the state of Ohio for 14 years before becoming a senator?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT CASE WHEN SUM(CAST(strftime('%Y', T2.end) AS int) - CAST(strftime('%Y', T2.start) AS int)) = 14 THEN official_full_name END FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.religion_bio = 'Lutheran' AND T2.state = 'OH' AND T2.type = 'rep' |
Write SQL query to solve given problem: Among all the current legislators born after the year 1960, how many of them are not google entities?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT COUNT(*) FROM current WHERE strftime('%Y', birthday_bio) > '1960' AND google_entity_id_id IS NULL |
Write SQL query to solve given problem: Please list the official full names of all the current legislators who have served in the U.S. House.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT official_full_name FROM current WHERE house_history_id IS NOT NULL |
Write SQL query to solve given problem: How many current legislators have both accounts on both VoteView.com and maplight.org?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT COUNT(*) FROM current WHERE icpsr_id IS NOT NULL AND maplight_id IS NOT NULL |
Write SQL query to solve given problem: Among all the current female legislators, how many of them have attended in Senate roll call votes?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT COUNT(lis_id) FROM current WHERE gender_bio = 'F' AND lis_id IS NOT NULL |
Write SQL query to solve given problem: What is the religion of current legislator Sherrod Brown?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | legislator | SELECT religion_bio FROM current WHERE official_full_name = 'Sherrod Brown' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.