human
Schema:
county (County_Id, County_name, Population, Zip_code)
party (Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate)
election (Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee)
Please answer with SQL.
assistant
Sure, I understand.
human
Show the name of the party that has the most delegates.
assistant
SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T1.Party ORDER BY COUNT(*) DESC LIMIT 1
human
Show all the information about election.
assistant
SELECT * FROM election
human
How many distinct governors are there?
assistant
SELECT count(DISTINCT Governor) FROM party
human
Show the people that have been comptroller the most times and the corresponding number of times.
assistant
SELECT Comptroller , COUNT(*) FROM party GROUP BY Comptroller ORDER BY COUNT(*) DESC LIMIT 1
human
Show the lieutenant governor and comptroller from the democratic party.
assistant
SELECT Lieutenant_Governor , Comptroller FROM party WHERE Party = 'Democratic'
human
Show the people that have been governor the most times.
assistant
SELECT Governor FROM party GROUP BY Governor ORDER BY COUNT( * ) DESC LIMIT 1 ;