Company: Agoda_15dec
Difficulty: medium
Problem Description As part of HackerPoll's election exit poll analytics, your team needs a report that summarizes the vote counts for each candidate, broken down by US state. Write a query to calculate the total votes each candidate received in each state based on the results table. Then, aggregate this data so that each state has a single row containing a formatted, comma-separated list of candidates and their respective vote counts. Schema candidates Column Name Data Type Description id SMALLINT Candidate ID (Primary Key) first_name VARCHAR(64) Candidate's first name last_name VARCHAR(64) Candidate's last name results Column Name Data Type Description candidate_id SMALLINT Candidate ID (Foreign Key to candidates.id) state VARCHAR(19) US state where the vote was cast Note: Each row in the results table represents a single vote cast for a candidate in the specified state. Required Output Your query should return a result set with exactly two columns, formatted and ordered as follows: