Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Based on the following table, CREATE TABLE Poster ( userid INTEGER NOT NULL, pos

ID: 3844256 • Letter: B

Question

Based on the following table,

CREATE TABLE Poster (
userid INTEGER NOT NULL,
poster_since DATETIME NOT NULL,
works_since DATE,

publisherid INTEGER,

PRIMARY KEY (userid),

FOREIGN KEY (userid) REFERENCES Users (userid) ON DELETE CASCADE,
FOREIGN KEY (publisherid) REFERENCES Publisher (publisherid) ON DELETE SET NULL);

Write and execute the ALTER TABLE statement(s) needed to modify the Poster table so that
whenever the Publisher associated with the poster is deleted then the Poster data is deleted too.

Explanation / Answer

ALTER TABLE Poster

ADD CONSTRAINT poster_ibfk_2

FOREIGN KEY (publisherid) REFERENCES Publisher (publisherid)

ON DELETE CASCADE;