Database schema:

CREATE TABLE chapters (
	id INTEGER -- example: ['18704', '18705'],
	"Act" INTEGER NOT NULL -- example: ['2', '1'],
	"Scene" INTEGER NOT NULL -- example: ['2', '1'],
	"Description" TEXT NOT NULL -- example: ['The sea-coast.', 'DUKE ORSINO’s palace.'],
	work_id INTEGER NOT NULL -- example: ['2', '1'],
	PRIMARY KEY (id), 
	CONSTRAINT fk_chapters_works FOREIGN KEY(work_id) REFERENCES works (id)
)


CREATE TABLE characters (
	id INTEGER -- example: ['2', '1'],
	"CharName" TEXT NOT NULL -- example: ['First Citizen', 'First Apparition'],
	"Abbrev" TEXT NOT NULL -- example: ['First Citizen', 'First Apparition'],
	"Description" TEXT NOT NULL -- example: ['', 'A senator of Venice'],
	PRIMARY KEY (id)
)


CREATE TABLE paragraphs (
	id INTEGER -- example: ['630863', '630864'],
	"ParagraphNum" INTEGER NOT NULL -- example: ['4', '3'],
	"PlainText" TEXT NOT NULL -- example: ['[Enter DUKE ORSINO, CURIO, and other Lords; Musici', 'If music be the food of love, play on;\nGive me exc'],
	character_id INTEGER NOT NULL -- example: ['1261', '840'],
	chapter_id INTEGER DEFAULT 0 NOT NULL -- example: ['18704', '18705'],
	PRIMARY KEY (id), 
	CONSTRAINT fk_paragraphs_chapters FOREIGN KEY(chapter_id) REFERENCES chapters (id),
	CONSTRAINT fk_paragraphs_characters FOREIGN KEY(character_id) REFERENCES characters (id)
)


CREATE TABLE works (
	id INTEGER -- example: ['2', '1'],
	"Title" TEXT NOT NULL -- example: ['Twelfth Night', "All's Well That Ends Well"],
	"LongTitle" TEXT NOT NULL -- example: ['Twelfth Night, Or What You Will', "All's Well That Ends Well"],
	"Date" INTEGER NOT NULL -- example: ['1602', '1599'],
	"GenreType" TEXT NOT NULL -- example: ['Tragedy', 'Comedy'],
	PRIMARY KEY (id)
)

Question: How many chapters does the character Demetrius show in the story?
Evidence: character Demetrius refers to CharName = 'Demetrius'

SQL:
SELECT COUNT(DISTINCT T2.chapter_id) FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T1.CharName = 'Demetrius'