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: How many episodes are there in the 9th season of Law and Order? Calculate the average number of casts per season of the said series.
Evidence: the 9th season refers to season = 9; Law and Order refers to series = 'Law and Order'; cast refers to category = 'Cast'; average number of casts per season = divide(count(person_id), count(episode_id))

SQL:
SELECT SUM(CASE WHEN T2.season = 9 THEN 1 ELSE 0 END) AS num , CAST(SUM(CASE WHEN T2.season = 9 THEN 1 ELSE 0 END) AS REAL) / COUNT(T1.episode_id) FROM Credit AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.category = 'Cast' AND T2.series = 'Law and Order'