1sf/bird-sql-train-with-schema huggingface dataset:
Database: legislator
Tables: current, current-terms, historical, historical-terms, social-media
Columns (table index, column name): -1, *, 0, ballotpedia_id, 0, bioguide_id, 0, birthday_bio, 0, cspan_id, 0, fec_id, 0, first_name, 0, gender_bio, 0, google_entity_id_id, 0, govtrack_id, 0, house_history_id, 0, icpsr_id, 0, last_name, 0, lis_id, 0, maplight_id, 0, middle_name, 0, nickname_name, 0, official_full_name, 0, opensecrets_id, 0, religion_bio, 0, suffix_name, 0, thomas_id, 0, votesmart_id, 0, wikidata_id, 0, wikipedia_id, 1, address, 1, bioguide, 1, caucus, 1, chamber, 1, class, 1, contact_form, 1, district, 1, end, 1, fax, 1, last, 1, name, 1, office, 1, party, 1, party_affiliations, 1, phone, 1, relation, 1, rss_url, 1, start, 1, state, 1, state_rank, 1, title, 1, type, 1, url, 2, ballotpedia_id, 2, bioguide_id, 2, bioguide_previous_id, 2, birthday_bio, 2, cspan_id, 2, fec_id, 2, first_name, 2, gender_bio, 2, google_entity_id_id, 2, govtrack_id, 2, house_history_alternate_id, 2, house_history_id, 2, icpsr_id, 2, last_name, 2, lis_id, 2, maplight_id, 2, middle_name, 2, nickname_name, 2, official_full_name, 2, opensecrets_id, 2, religion_bio, 2, suffix_name, 2, thomas_id, 2, votesmart_id, 2, wikidata_id, 2, wikipedia_id, 3, address, 3, bioguide, 3, chamber, 3, class, 3, contact_form, 3, district, 3, end, 3, fax, 3, last, 3, middle, 3, name, 3, office, 3, party, 3, party_affiliations, 3, phone, 3, relation, 3, rss_url, 3, start, 3, state, 3, state_rank, 3, title, 3, type, 3, url, 4, bioguide, 4, facebook, 4, facebook_id, 4, govtrack, 4, instagram, 4, instagram_id, 4, thomas, 4, twitter, 4, twitter_id, 4, youtube, 4, youtube_id
Question: For how many terms have the oldest current legislator served?
Evidence: oldest legislator refers to MIN(birthday_bio);
SQL: SELECT COUNT(T2.bioguide) FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.birthday_bio = ( SELECT MIN(birthday_bio) FROM current )
Database: legislator
Tables: current, current-terms, historical, historical-terms, social-media
Columns (table index, column name): -1, *, 0, ballotpedia_id, 0, bioguide_id, 0, birthday_bio, 0, cspan_id, 0, fec_id, 0, first_name, 0, gender_bio, 0, google_entity_id_id, 0, govtrack_id, 0, house_history_id, 0, icpsr_id, 0, last_name, 0, lis_id, 0, maplight_id, 0, middle_name, 0, nickname_name, 0, official_full_name, 0, opensecrets_id, 0, religion_bio, 0, suffix_name, 0, thomas_id, 0, votesmart_id, 0, wikidata_id, 0, wikipedia_id, 1, address, 1, bioguide, 1, caucus, 1, chamber, 1, class, 1, contact_form, 1, district, 1, end, 1, fax, 1, last, 1, name, 1, office, 1, party, 1, party_affiliations, 1, phone, 1, relation, 1, rss_url, 1, start, 1, state, 1, state_rank, 1, title, 1, type, 1, url, 2, ballotpedia_id, 2, bioguide_id, 2, bioguide_previous_id, 2, birthday_bio, 2, cspan_id, 2, fec_id, 2, first_name, 2, gender_bio, 2, google_entity_id_id, 2, govtrack_id, 2, house_history_alternate_id, 2, house_history_id, 2, icpsr_id, 2, last_name, 2, lis_id, 2, maplight_id, 2, middle_name, 2, nickname_name, 2, official_full_name, 2, opensecrets_id, 2, religion_bio, 2, suffix_name, 2, thomas_id, 2, votesmart_id, 2, wikidata_id, 2, wikipedia_id, 3, address, 3, bioguide, 3, chamber, 3, class, 3, contact_form, 3, district, 3, end, 3, fax, 3, last, 3, middle, 3, name, 3, office, 3, party, 3, party_affiliations, 3, phone, 3, relation, 3, rss_url, 3, start, 3, state, 3, state_rank, 3, title, 3, type, 3, url, 4, bioguide, 4, facebook, 4, facebook_id, 4, govtrack, 4, instagram, 4, instagram_id, 4, thomas, 4, twitter, 4, twitter_id, 4, youtube, 4, youtube_id
Question: What was current legislator Sherrod Brown's Washington, D.C. office phone number during his term starting on 2013/1/3?
Evidence: Washington, DC office phone number refers to phone; terms starting on 2013/1/3 refers to start = '2013-01-03';
SQL: SELECT T1.phone FROM `current-terms` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.official_full_name = 'Sherrod Brown' AND T1.start = '2013-01-03'
Database: legislator
Tables: current, current-terms, historical, historical-terms, social-media
Columns (table index, column name): -1, *, 0, ballotpedia_id, 0, bioguide_id, 0, birthday_bio, 0, cspan_id, 0, fec_id, 0, first_name, 0, gender_bio, 0, google_entity_id_id, 0, govtrack_id, 0, house_history_id, 0, icpsr_id, 0, last_name, 0, lis_id, 0, maplight_id, 0, middle_name, 0, nickname_name, 0, official_full_name, 0, opensecrets_id, 0, religion_bio, 0, suffix_name, 0, thomas_id, 0, votesmart_id, 0, wikidata_id, 0, wikipedia_id, 1, address, 1, bioguide, 1, caucus, 1, chamber, 1, class, 1, contact_form, 1, district, 1, end, 1, fax, 1, last, 1, name, 1, office, 1, party, 1, party_affiliations, 1, phone, 1, relation, 1, rss_url, 1, start, 1, state, 1, state_rank, 1, title, 1, type, 1, url, 2, ballotpedia_id, 2, bioguide_id, 2, bioguide_previous_id, 2, birthday_bio, 2, cspan_id, 2, fec_id, 2, first_name, 2, gender_bio, 2, google_entity_id_id, 2, govtrack_id, 2, house_history_alternate_id, 2, house_history_id, 2, icpsr_id, 2, last_name, 2, lis_id, 2, maplight_id, 2, middle_name, 2, nickname_name, 2, official_full_name, 2, opensecrets_id, 2, religion_bio, 2, suffix_name, 2, thomas_id, 2, votesmart_id, 2, wikidata_id, 2, wikipedia_id, 3, address, 3, bioguide, 3, chamber, 3, class, 3, contact_form, 3, district, 3, end, 3, fax, 3, last, 3, middle, 3, name, 3, office, 3, party, 3, party_affiliations, 3, phone, 3, relation, 3, rss_url, 3, start, 3, state, 3, state_rank, 3, title, 3, type, 3, url, 4, bioguide, 4, facebook, 4, facebook_id, 4, govtrack, 4, instagram, 4, instagram_id, 4, thomas, 4, twitter, 4, twitter_id, 4, youtube, 4, youtube_id
Question: Current legislator Sherrod Brown has been in the Democrat party during how many terms that he has served?
SQL: 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' AND T2.party = 'Democrat'
Database: legislator
Tables: current, current-terms, historical, historical-terms, social-media
Columns (table index, column name): -1, *, 0, ballotpedia_id, 0, bioguide_id, 0, birthday_bio, 0, cspan_id, 0, fec_id, 0, first_name, 0, gender_bio, 0, google_entity_id_id, 0, govtrack_id, 0, house_history_id, 0, icpsr_id, 0, last_name, 0, lis_id, 0, maplight_id, 0, middle_name, 0, nickname_name, 0, official_full_name, 0, opensecrets_id, 0, religion_bio, 0, suffix_name, 0, thomas_id, 0, votesmart_id, 0, wikidata_id, 0, wikipedia_id, 1, address, 1, bioguide, 1, caucus, 1, chamber, 1, class, 1, contact_form, 1, district, 1, end, 1, fax, 1, last, 1, name, 1, office, 1, party, 1, party_affiliations, 1, phone, 1, relation, 1, rss_url, 1, start, 1, state, 1, state_rank, 1, title, 1, type, 1, url, 2, ballotpedia_id, 2, bioguide_id, 2, bioguide_previous_id, 2, birthday_bio, 2, cspan_id, 2, fec_id, 2, first_name, 2, gender_bio, 2, google_entity_id_id, 2, govtrack_id, 2, house_history_alternate_id, 2, house_history_id, 2, icpsr_id, 2, last_name, 2, lis_id, 2, maplight_id, 2, middle_name, 2, nickname_name, 2, official_full_name, 2, opensecrets_id, 2, religion_bio, 2, suffix_name, 2, thomas_id, 2, votesmart_id, 2, wikidata_id, 2, wikipedia_id, 3, address, 3, bioguide, 3, chamber, 3, class, 3, contact_form, 3, district, 3, end, 3, fax, 3, last, 3, middle, 3, name, 3, office, 3, party, 3, party_affiliations, 3, phone, 3, relation, 3, rss_url, 3, start, 3, state, 3, state_rank, 3, title, 3, type, 3, url, 4, bioguide, 4, facebook, 4, facebook_id, 4, govtrack, 4, instagram, 4, instagram_id, 4, thomas, 4, twitter, 4, twitter_id, 4, youtube, 4, youtube_id
Question: Please list the full official names of all the current legislators who served the term that started on 2013/1/3.
Evidence: term that started on 2013/1/3 refers to start = '2013-01-03';
SQL: SELECT T1.official_full_name FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.start = '2013-01-03'
Database: legislator
Tables: current, current-terms, historical, historical-terms, social-media
Columns (table index, column name): -1, *, 0, ballotpedia_id, 0, bioguide_id, 0, birthday_bio, 0, cspan_id, 0, fec_id, 0, first_name, 0, gender_bio, 0, google_entity_id_id, 0, govtrack_id, 0, house_history_id, 0, icpsr_id, 0, last_name, 0, lis_id, 0, maplight_id, 0, middle_name, 0, nickname_name, 0, official_full_name, 0, opensecrets_id, 0, religion_bio, 0, suffix_name, 0, thomas_id, 0, votesmart_id, 0, wikidata_id, 0, wikipedia_id, 1, address, 1, bioguide, 1, caucus, 1, chamber, 1, class, 1, contact_form, 1, district, 1, end, 1, fax, 1, last, 1, name, 1, office, 1, party, 1, party_affiliations, 1, phone, 1, relation, 1, rss_url, 1, start, 1, state, 1, state_rank, 1, title, 1, type, 1, url, 2, ballotpedia_id, 2, bioguide_id, 2, bioguide_previous_id, 2, birthday_bio, 2, cspan_id, 2, fec_id, 2, first_name, 2, gender_bio, 2, google_entity_id_id, 2, govtrack_id, 2, house_history_alternate_id, 2, house_history_id, 2, icpsr_id, 2, last_name, 2, lis_id, 2, maplight_id, 2, middle_name, 2, nickname_name, 2, official_full_name, 2, opensecrets_id, 2, religion_bio, 2, suffix_name, 2, thomas_id, 2, votesmart_id, 2, wikidata_id, 2, wikipedia_id, 3, address, 3, bioguide, 3, chamber, 3, class, 3, contact_form, 3, district, 3, end, 3, fax, 3, last, 3, middle, 3, name, 3, office, 3, party, 3, party_affiliations, 3, phone, 3, relation, 3, rss_url, 3, start, 3, state, 3, state_rank, 3, title, 3, type, 3, url, 4, bioguide, 4, facebook, 4, facebook_id, 4, govtrack, 4, instagram, 4, instagram_id, 4, thomas, 4, twitter, 4, twitter_id, 4, youtube, 4, youtube_id
Question: Among the current legislators who served the term starting on 2013/1/3, how many of them are female?
Evidence: term starting on 2013/1/3 refers to start = '2013-01-03; female refers to gender_bio = 'F';
SQL: SELECT COUNT(*) FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.start = '2013-01-03' AND T1.gender_bio = 'F'
Database: legislator
Tables: current, current-terms, historical, historical-terms, social-media
Columns (table index, column name): -1, *, 0, ballotpedia_id, 0, bioguide_id, 0, birthday_bio, 0, cspan_id, 0, fec_id, 0, first_name, 0, gender_bio, 0, google_entity_id_id, 0, govtrack_id, 0, house_history_id, 0, icpsr_id, 0, last_name, 0, lis_id, 0, maplight_id, 0, middle_name, 0, nickname_name, 0, official_full_name, 0, opensecrets_id, 0, religion_bio, 0, suffix_name, 0, thomas_id, 0, votesmart_id, 0, wikidata_id, 0, wikipedia_id, 1, address, 1, bioguide, 1, caucus, 1, chamber, 1, class, 1, contact_form, 1, district, 1, end, 1, fax, 1, last, 1, name, 1, office, 1, party, 1, party_affiliations, 1, phone, 1, relation, 1, rss_url, 1, start, 1, state, 1, state_rank, 1, title, 1, type, 1, url, 2, ballotpedia_id, 2, bioguide_id, 2, bioguide_previous_id, 2, birthday_bio, 2, cspan_id, 2, fec_id, 2, first_name, 2, gender_bio, 2, google_entity_id_id, 2, govtrack_id, 2, house_history_alternate_id, 2, house_history_id, 2, icpsr_id, 2, last_name, 2, lis_id, 2, maplight_id, 2, middle_name, 2, nickname_name, 2, official_full_name, 2, opensecrets_id, 2, religion_bio, 2, suffix_name, 2, thomas_id, 2, votesmart_id, 2, wikidata_id, 2, wikipedia_id, 3, address, 3, bioguide, 3, chamber, 3, class, 3, contact_form, 3, district, 3, end, 3, fax, 3, last, 3, middle, 3, name, 3, office, 3, party, 3, party_affiliations, 3, phone, 3, relation, 3, rss_url, 3, start, 3, state, 3, state_rank, 3, title, 3, type, 3, url, 4, bioguide, 4, facebook, 4, facebook_id, 4, govtrack, 4, instagram, 4, instagram_id, 4, thomas, 4, twitter, 4, twitter_id, 4, youtube, 4, youtube_id
Question: What is the full official name of the current legislator that has served for the most number of terms?
Evidence: served for the most number of terms refers to MAX(COUNT(bioguide));
SQL: SELECT T1.official_full_name FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide GROUP BY T1.official_full_name, T2.bioguide ORDER BY COUNT(T2.bioguide) DESC LIMIT 1
Database: legislator
Tables: current, current-terms, historical, historical-terms, social-media
Columns (table index, column name): -1, *, 0, ballotpedia_id, 0, bioguide_id, 0, birthday_bio, 0, cspan_id, 0, fec_id, 0, first_name, 0, gender_bio, 0, google_entity_id_id, 0, govtrack_id, 0, house_history_id, 0, icpsr_id, 0, last_name, 0, lis_id, 0, maplight_id, 0, middle_name, 0, nickname_name, 0, official_full_name, 0, opensecrets_id, 0, religion_bio, 0, suffix_name, 0, thomas_id, 0, votesmart_id, 0, wikidata_id, 0, wikipedia_id, 1, address, 1, bioguide, 1, caucus, 1, chamber, 1, class, 1, contact_form, 1, district, 1, end, 1, fax, 1, last, 1, name, 1, office, 1, party, 1, party_affiliations, 1, phone, 1, relation, 1, rss_url, 1, start, 1, state, 1, state_rank, 1, title, 1, type, 1, url, 2, ballotpedia_id, 2, bioguide_id, 2, bioguide_previous_id, 2, birthday_bio, 2, cspan_id, 2, fec_id, 2, first_name, 2, gender_bio, 2, google_entity_id_id, 2, govtrack_id, 2, house_history_alternate_id, 2, house_history_id, 2, icpsr_id, 2, last_name, 2, lis_id, 2, maplight_id, 2, middle_name, 2, nickname_name, 2, official_full_name, 2, opensecrets_id, 2, religion_bio, 2, suffix_name, 2, thomas_id, 2, votesmart_id, 2, wikidata_id, 2, wikipedia_id, 3, address, 3, bioguide, 3, chamber, 3, class, 3, contact_form, 3, district, 3, end, 3, fax, 3, last, 3, middle, 3, name, 3, office, 3, party, 3, party_affiliations, 3, phone, 3, relation, 3, rss_url, 3, start, 3, state, 3, state_rank, 3, title, 3, type, 3, url, 4, bioguide, 4, facebook, 4, facebook_id, 4, govtrack, 4, instagram, 4, instagram_id, 4, thomas, 4, twitter, 4, twitter_id, 4, youtube, 4, youtube_id
Question: For how many terms has current legislator Sherrod Brown served as a representative for district no.13?
Evidence: district no. 13 refers to district = 13;
SQL: 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' AND T2.district = 13
Database: legislator
Tables: current, current-terms, historical, historical-terms, social-media
Columns (table index, column name): -1, *, 0, ballotpedia_id, 0, bioguide_id, 0, birthday_bio, 0, cspan_id, 0, fec_id, 0, first_name, 0, gender_bio, 0, google_entity_id_id, 0, govtrack_id, 0, house_history_id, 0, icpsr_id, 0, last_name, 0, lis_id, 0, maplight_id, 0, middle_name, 0, nickname_name, 0, official_full_name, 0, opensecrets_id, 0, religion_bio, 0, suffix_name, 0, thomas_id, 0, votesmart_id, 0, wikidata_id, 0, wikipedia_id, 1, address, 1, bioguide, 1, caucus, 1, chamber, 1, class, 1, contact_form, 1, district, 1, end, 1, fax, 1, last, 1, name, 1, office, 1, party, 1, party_affiliations, 1, phone, 1, relation, 1, rss_url, 1, start, 1, state, 1, state_rank, 1, title, 1, type, 1, url, 2, ballotpedia_id, 2, bioguide_id, 2, bioguide_previous_id, 2, birthday_bio, 2, cspan_id, 2, fec_id, 2, first_name, 2, gender_bio, 2, google_entity_id_id, 2, govtrack_id, 2, house_history_alternate_id, 2, house_history_id, 2, icpsr_id, 2, last_name, 2, lis_id, 2, maplight_id, 2, middle_name, 2, nickname_name, 2, official_full_name, 2, opensecrets_id, 2, religion_bio, 2, suffix_name, 2, thomas_id, 2, votesmart_id, 2, wikidata_id, 2, wikipedia_id, 3, address, 3, bioguide, 3, chamber, 3, class, 3, contact_form, 3, district, 3, end, 3, fax, 3, last, 3, middle, 3, name, 3, office, 3, party, 3, party_affiliations, 3, phone, 3, relation, 3, rss_url, 3, start, 3, state, 3, state_rank, 3, title, 3, type, 3, url, 4, bioguide, 4, facebook, 4, facebook_id, 4, govtrack, 4, instagram, 4, instagram_id, 4, thomas, 4, twitter, 4, twitter_id, 4, youtube, 4, youtube_id
Question: What is the official full name of the current legislator whose current official Facebook presence is "senjoniernst"?
Evidence: current official Facebook presence is "senjoniernst" refers to facebook = 'senjoniernst';
SQL: SELECT T1.official_full_name FROM current AS T1 INNER JOIN `social-media` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.facebook = 'senjoniernst'
Database: legislator
Tables: current, current-terms, historical, historical-terms, social-media
Columns (table index, column name): -1, *, 0, ballotpedia_id, 0, bioguide_id, 0, birthday_bio, 0, cspan_id, 0, fec_id, 0, first_name, 0, gender_bio, 0, google_entity_id_id, 0, govtrack_id, 0, house_history_id, 0, icpsr_id, 0, last_name, 0, lis_id, 0, maplight_id, 0, middle_name, 0, nickname_name, 0, official_full_name, 0, opensecrets_id, 0, religion_bio, 0, suffix_name, 0, thomas_id, 0, votesmart_id, 0, wikidata_id, 0, wikipedia_id, 1, address, 1, bioguide, 1, caucus, 1, chamber, 1, class, 1, contact_form, 1, district, 1, end, 1, fax, 1, last, 1, name, 1, office, 1, party, 1, party_affiliations, 1, phone, 1, relation, 1, rss_url, 1, start, 1, state, 1, state_rank, 1, title, 1, type, 1, url, 2, ballotpedia_id, 2, bioguide_id, 2, bioguide_previous_id, 2, birthday_bio, 2, cspan_id, 2, fec_id, 2, first_name, 2, gender_bio, 2, google_entity_id_id, 2, govtrack_id, 2, house_history_alternate_id, 2, house_history_id, 2, icpsr_id, 2, last_name, 2, lis_id, 2, maplight_id, 2, middle_name, 2, nickname_name, 2, official_full_name, 2, opensecrets_id, 2, religion_bio, 2, suffix_name, 2, thomas_id, 2, votesmart_id, 2, wikidata_id, 2, wikipedia_id, 3, address, 3, bioguide, 3, chamber, 3, class, 3, contact_form, 3, district, 3, end, 3, fax, 3, last, 3, middle, 3, name, 3, office, 3, party, 3, party_affiliations, 3, phone, 3, relation, 3, rss_url, 3, start, 3, state, 3, state_rank, 3, title, 3, type, 3, url, 4, bioguide, 4, facebook, 4, facebook_id, 4, govtrack, 4, instagram, 4, instagram_id, 4, thomas, 4, twitter, 4, twitter_id, 4, youtube, 4, youtube_id
Question: Which current legislator has served for more terms, Sherrod Brown or Maria Cantwell?
Evidence: if sum(official_full_name = 'Maria Cantwell') > sum(official_full_name = 'Sherrod Brown') then Maria Cantwell has served for more term than Sherrod Brown; if sum(official_full_name = 'Sherrod Brown') > sum(official_full_name = 'Maria Cantwell'), then Sherrod Brown has served for more terms than Maria Cantwell;
SQL: SELECT CASE WHEN SUM(CASE WHEN T1.official_full_name = 'Maria Cantwell' THEN 1 ELSE 0 END) > SUM(CASE WHEN T1.official_full_name = 'Sherrod Brown' THEN 1 ELSE 0 END) THEN 'Maria Cantwell' ELSE 'Sherrod Brown' END FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide
Database: legislator
Tables: current, current-terms, historical, historical-terms, social-media
Columns (table index, column name): -1, *, 0, ballotpedia_id, 0, bioguide_id, 0, birthday_bio, 0, cspan_id, 0, fec_id, 0, first_name, 0, gender_bio, 0, google_entity_id_id, 0, govtrack_id, 0, house_history_id, 0, icpsr_id, 0, last_name, 0, lis_id, 0, maplight_id, 0, middle_name, 0, nickname_name, 0, official_full_name, 0, opensecrets_id, 0, religion_bio, 0, suffix_name, 0, thomas_id, 0, votesmart_id, 0, wikidata_id, 0, wikipedia_id, 1, address, 1, bioguide, 1, caucus, 1, chamber, 1, class, 1, contact_form, 1, district, 1, end, 1, fax, 1, last, 1, name, 1, office, 1, party, 1, party_affiliations, 1, phone, 1, relation, 1, rss_url, 1, start, 1, state, 1, state_rank, 1, title, 1, type, 1, url, 2, ballotpedia_id, 2, bioguide_id, 2, bioguide_previous_id, 2, birthday_bio, 2, cspan_id, 2, fec_id, 2, first_name, 2, gender_bio, 2, google_entity_id_id, 2, govtrack_id, 2, house_history_alternate_id, 2, house_history_id, 2, icpsr_id, 2, last_name, 2, lis_id, 2, maplight_id, 2, middle_name, 2, nickname_name, 2, official_full_name, 2, opensecrets_id, 2, religion_bio, 2, suffix_name, 2, thomas_id, 2, votesmart_id, 2, wikidata_id, 2, wikipedia_id, 3, address, 3, bioguide, 3, chamber, 3, class, 3, contact_form, 3, district, 3, end, 3, fax, 3, last, 3, middle, 3, name, 3, office, 3, party, 3, party_affiliations, 3, phone, 3, relation, 3, rss_url, 3, start, 3, state, 3, state_rank, 3, title, 3, type, 3, url, 4, bioguide, 4, facebook, 4, facebook_id, 4, govtrack, 4, instagram, 4, instagram_id, 4, thomas, 4, twitter, 4, twitter_id, 4, youtube, 4, youtube_id
Question: Among all the current legislators who have served for more than 4 terms, what is the percentage of them being female?
Evidence: have served for more than 4 years refers to count(bioguide) > 4; percentage = MULTIPLY(DIVIDE(SUM(gender_bio = 'F'), count(bioguide)), 100.0); female refers to gender_bio = 'F'
SQL: SELECT CAST(SUM(CASE WHEN gender_bio = 'F' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T3.bioguide) FROM ( SELECT T2.bioguide, T1.gender_bio FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide GROUP BY T2.bioguide HAVING COUNT(T2.bioguide) > 4 ) T3
Database: legislator
Tables: current, current-terms, historical, historical-terms, social-media
Columns (table index, column name): -1, *, 0, ballotpedia_id, 0, bioguide_id, 0, birthday_bio, 0, cspan_id, 0, fec_id, 0, first_name, 0, gender_bio, 0, google_entity_id_id, 0, govtrack_id, 0, house_history_id, 0, icpsr_id, 0, last_name, 0, lis_id, 0, maplight_id, 0, middle_name, 0, nickname_name, 0, official_full_name, 0, opensecrets_id, 0, religion_bio, 0, suffix_name, 0, thomas_id, 0, votesmart_id, 0, wikidata_id, 0, wikipedia_id, 1, address, 1, bioguide, 1, caucus, 1, chamber, 1, class, 1, contact_form, 1, district, 1, end, 1, fax, 1, last, 1, name, 1, office, 1, party, 1, party_affiliations, 1, phone, 1, relation, 1, rss_url, 1, start, 1, state, 1, state_rank, 1, title, 1, type, 1, url, 2, ballotpedia_id, 2, bioguide_id, 2, bioguide_previous_id, 2, birthday_bio, 2, cspan_id, 2, fec_id, 2, first_name, 2, gender_bio, 2, google_entity_id_id, 2, govtrack_id, 2, house_history_alternate_id, 2, house_history_id, 2, icpsr_id, 2, last_name, 2, lis_id, 2, maplight_id, 2, middle_name, 2, nickname_name, 2, official_full_name, 2, opensecrets_id, 2, religion_bio, 2, suffix_name, 2, thomas_id, 2, votesmart_id, 2, wikidata_id, 2, wikipedia_id, 3, address, 3, bioguide, 3, chamber, 3, class, 3, contact_form, 3, district, 3, end, 3, fax, 3, last, 3, middle, 3, name, 3, office, 3, party, 3, party_affiliations, 3, phone, 3, relation, 3, rss_url, 3, start, 3, state, 3, state_rank, 3, title, 3, type, 3, url, 4, bioguide, 4, facebook, 4, facebook_id, 4, govtrack, 4, instagram, 4, instagram_id, 4, thomas, 4, twitter, 4, twitter_id, 4, youtube, 4, youtube_id
Question: What is the average number of terms served for a current legislator that's famous or impact?
Evidence: average = DIVIDE(COUNT(bioguide), COUNT(bioguide_id)); legislator that's famous or impact refers to wikipedia_id is not null;
SQL: 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.wikipedia_id IS NOT NULL