Database schema:

CREATE TABLE "Award" (
	award_id INTEGER -- example: ['326', '325'],
	organization TEXT -- example: ['Annie Awards', 'Primetime Emmy Awards'],
	year INTEGER -- example: ['2010', '2009'],
	award_category TEXT -- example: ['Primetime Emmy', 'Annie'],
	award TEXT -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Programming Less'],
	person TEXT -- example: ['Dan Castellaneta', 'Hank Azaria'],
	role TEXT -- example: ['co-executive producer', 'executive producer'],
	episode_id TEXT -- example: ['S20-E18', 'S20-E16'],
	season TEXT, 
	song TEXT, 
	result TEXT -- example: ['Nominee', 'Winner'],
	PRIMARY KEY (award_id), 
	CONSTRAINT fk_award_person FOREIGN KEY(person) REFERENCES "Person" (name),
	CONSTRAINT fk_award_episode FOREIGN KEY(episode_id) REFERENCES "Episode" (episode_id)
)


CREATE TABLE "Character_Award" (
	award_id INTEGER -- example: ['326', '325'],
	character TEXT -- example: ['Moe Szyslak', 'Homer Simpson'],
	CONSTRAINT fk_character_award_award FOREIGN KEY(award_id) REFERENCES "Award" (award_id)
)


CREATE TABLE "Credit" (
	episode_id TEXT -- example: ['S20-E13', 'S20-E10'],
	category TEXT -- example: ['Casting Department', 'Animation Department'],
	person TEXT -- example: ['Adam Kuhlman', 'Bonita Pietila'],
	role TEXT -- example: ['additional timer', 'casting'],
	credited TEXT -- example: ['false', 'true'],
	CONSTRAINT fk_credit_episode FOREIGN KEY(episode_id) REFERENCES "Episode" (episode_id),
	CONSTRAINT fk_credit_person FOREIGN KEY(person) REFERENCES "Person" (name)
)


CREATE TABLE "Episode" (
	episode_id TEXT -- example: ['S20-E1', 'S20-E10'],
	season INTEGER -- example: ['20'],
	episode INTEGER -- example: ['2', '1'],
	number_in_series INTEGER -- example: ['421', '422'],
	title TEXT -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon'],
	summary TEXT -- example: ['Bart gets in trouble with Marge after she finds ou', 'Homer and Ned go into business together as bounty '],
	air_date TEXT -- example: ['2008-09-28', '2008-10-05'],
	episode_image TEXT -- example: ['https://m.media-amazon.com/images/M/MV5BMjMyNzU4OD', 'https://m.media-amazon.com/images/M/MV5BMTYwMzk2Nj'],
	rating REAL -- example: ['7.2', '7.0'],
	votes INTEGER -- example: ['1055', '1192'],
	PRIMARY KEY (episode_id)
)


CREATE TABLE "Keyword" (
	episode_id TEXT -- example: ['S20-E1', 'S20-E10'],
	keyword TEXT -- example: ['1930s to 2020s', 'erotic bakery'],
	PRIMARY KEY (episode_id, keyword), 
	CONSTRAINT fk_keyword_episode FOREIGN KEY(episode_id) REFERENCES "Episode" (episode_id)
)


CREATE TABLE "Person" (
	name TEXT -- example: ['Adam Greeley', 'Adam Klein'],
	birthdate TEXT -- example: ['1975-03-30', '1963-05-04'],
	birth_name TEXT -- example: ['Marc Edward Wilmore', 'Valentina Lantigua'],
	birth_place TEXT -- example: ['Brooklyn', 'USA'],
	birth_region TEXT -- example: ['New York', 'California'],
	birth_country TEXT -- example: ['USA', 'Canada'],
	height_meters REAL -- example: ['1.75', '1.85'],
	nickname TEXT -- example: ['Jim', 'Doofus'],
	PRIMARY KEY (name)
)


CREATE TABLE "Vote" (
	episode_id TEXT -- example: ['S20-E1', 'S20-E10'],
	stars INTEGER -- example: ['2', '3'],
	votes INTEGER -- example: ['20', '16'],
	percent REAL -- example: ['1.3', '1.7'],
	CONSTRAINT fk_vote_episode FOREIGN KEY(episode_id) REFERENCES "Episode" (episode_id)
)

Question: What character did Dan Castellaneta play that won him an award for Outstanding Voice-Over Performance in 2009 in the Primetime Emmy Awards?
Evidence: "Dan Castellaneta" is the person; won refers to result = 'Winner'; 'Outstanding Voice-Over Performance' is the award; 'Primetime Emmy Awards' is the organization; in 2009 refers to year = 2009

SQL:
SELECT DISTINCT T2.character FROM Award AS T1 INNER JOIN Character_Award AS T2 ON T1.award_id = T2.award_id WHERE T1.person = 'Dan Castellaneta' AND T1.award = 'Outstanding Voice-Over Performance' AND T1.organization = 'Primetime Emmy Awards' AND T1.year = 2009;