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 are the names of representatives and the dates of elections they participated in.
assistant
SELECT T2.Name , T1.Date FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID
human
What are the names of representatives whose party is not 'Republican'?
assistant
SELECT Name FROM Representative WHERE Party != 'Republican'
human
What are the different parties of representative? Show the party name and the number of representatives in each party.
assistant
SELECT Party , COUNT(*) FROM representative GROUP BY Party
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 are the names and parties of representatives?
assistant
SELECT Name , Party FROM representative ;