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 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 names and parties of representatives?
assistant
SELECT Name , Party FROM representative
human
How many distinct parties are there for representatives?
assistant
SELECT count(DISTINCT Party) FROM representative
human
What parties have at least three representatives?
assistant
SELECT Party FROM representative GROUP BY Party HAVING COUNT(*) >= 3
human
What states have at least two representatives?
assistant
SELECT State FROM representative GROUP BY State HAVING COUNT( * ) >= 2 ;