human
Schema:
election (Election_ID, Representative_ID, Date, Votes, Vote_Percent, Seats, Place)
representative (Representative_ID, Name, State, Party, Lifespan)
Please answer with SQL.
assistant
Sure, I understand.
human
What is the party that has the largest number of representatives?
assistant
SELECT Party , COUNT(*) FROM representative GROUP BY Party ORDER BY COUNT(*) DESC LIMIT 1
human
What are the minimum and maximum vote percents of elections?
assistant
SELECT min(Vote_Percent) , max(Vote_Percent) FROM election
human
What is the average number of votes of representatives from party 'Republican'?
assistant
SELECT avg(T1.Votes) FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID WHERE T2.Party = 'Republican'
human
What are the names of representatives in descending order of votes?
assistant
SELECT T2.Name FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID ORDER BY votes DESC
human
What are the life spans of representatives from New York state or Indiana state?
assistant
SELECT Lifespan FROM representative WHERE State = 'New York' OR State = 'Indiana'
human
What are the lifespans of representatives in descending order of vote percent?
assistant
SELECT T2.Lifespan FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID ORDER BY Vote_Percent DESC ;