Database schema:

CREATE TABLE "Award" (
	award_id INTEGER -- example: ['259', '258'],
	organization TEXT -- example: ['International Monitor Awards', 'Primetime Emmy Awards'],
	year INTEGER -- example: ['2000', '1999'],
	award_category TEXT -- example: ['Monitor', 'Primetime Emmy'],
	award TEXT -- example: ['Film Originated Television Series - Best Achieveme', 'Outstanding Costume Design for a Series'],
	series TEXT -- example: ['Law and Order'],
	episode_id TEXT -- example: ['tt0629398', 'tt0629149'],
	person_id TEXT -- example: ['nm0792309', 'nm0937725'],
	role TEXT -- example: ['Katrina Ludlow', 'production mixer'],
	result TEXT -- example: ['Nominee', 'Winner'],
	PRIMARY KEY (award_id), 
	CONSTRAINT fk_award_episode FOREIGN KEY(episode_id) REFERENCES "Episode" (episode_id),
	CONSTRAINT fk_award_person FOREIGN KEY(person_id) REFERENCES "Person" (person_id)
)


CREATE TABLE "Credit" (
	episode_id TEXT -- example: ['tt0629146', 'tt0629149'],
	person_id TEXT -- example: ['nm0000973', 'nm0001583'],
	category TEXT -- example: ['Additional Crew', 'Art Department'],
	role TEXT -- example: ['technical advisor', 'production accountant'],
	credited TEXT -- example: ['false', 'true'],
	PRIMARY KEY (episode_id, person_id), 
	CONSTRAINT fk_credit_episode FOREIGN KEY(episode_id) REFERENCES "Episode" (episode_id),
	CONSTRAINT fk_credit_person FOREIGN KEY(person_id) REFERENCES "Person" (person_id)
)


CREATE TABLE "Episode" (
	episode_id TEXT -- example: ['tt0629146', 'tt0629149'],
	series TEXT -- example: ['Law and Order'],
	season INTEGER -- example: ['9'],
	episode INTEGER -- example: ['2', '1'],
	number_in_series INTEGER -- example: ['182', '183'],
	title TEXT -- example: ['DWB', 'Cherished'],
	summary TEXT -- example: ['White police officers are accused of beating and d', 'New assistant DA Abbie Carmichael aggressively inv'],
	air_date DATE -- example: ['1998-09-23', '1998-10-07'],
	episode_image TEXT -- example: ['https://m.media-amazon.com/images/M/MV5BODFmZmI2YT', 'https://m.media-amazon.com/images/M/MV5BNWEyM2NkZj'],
	rating REAL -- example: ['7.9', '7.6'],
	votes INTEGER -- example: ['203', '177'],
	PRIMARY KEY (episode_id)
)


CREATE TABLE "Keyword" (
	episode_id TEXT -- example: ['tt0629239', 'tt0629397'],
	keyword TEXT -- example: ['nun', 'priest'],
	PRIMARY KEY (episode_id, keyword), 
	CONSTRAINT fk_keyword_episode FOREIGN KEY(episode_id) REFERENCES "Episode" (episode_id)
)


CREATE TABLE "Person" (
	person_id TEXT -- example: ['nm0000210', 'nm0000973'],
	name TEXT -- example: ['Julia Roberts', 'Rene Balcer'],
	birthdate DATE -- example: ['1967-10-28', '1954-02-09'],
	birth_name TEXT -- example: ['Rene Chenevert Balcer', 'Julia Fiona Roberts'],
	birth_place TEXT -- example: ['Montreal', 'Smyrna'],
	birth_region TEXT -- example: ['Quebec', 'Georgia'],
	birth_country TEXT -- example: ['USA', 'Canada'],
	height_meters REAL -- example: ['1.73', '1.88'],
	nickname TEXT -- example: ['Jules', 'Gus'],
	PRIMARY KEY (person_id)
)


CREATE TABLE "Vote" (
	episode_id TEXT -- example: ['tt0629228', 'tt0629204'],
	stars INTEGER -- example: ['9', '10'],
	votes INTEGER -- example: ['39', '36'],
	percent REAL -- example: ['17.7', '19.2'],
	CONSTRAINT fk_vote_episode FOREIGN KEY(episode_id) REFERENCES "Episode" (episode_id)
)

Question: What is the average rating for each episode in season 9?
Evidence: average rating = divide(sum(rating), count(episode_id))

SQL:
SELECT SUM(rating) / COUNT(episode_id) FROM Episode WHERE season = 9