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
How many parties in this table?
assistant
SELECT COUNT( DISTINCT Party ) FROM party;
human
Peter Vallone in which party?
assistant
SELECT Party FROM party WHERE Governor = 'Peter Vallone';
human
How many elections in this table?
assistant
SELECT COUNT( * ) FROM election;
human
Carl McCall in which party?
assistant
SELECT Party FROM party WHERE Governor = 'Carl McCall';
human
What are the names of parties that have both delegates on 'Appropriations'?
assistant
SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.Committee = "Appropriations" INTERSECT SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.Committee = "Economic Matters" ;