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;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.