DROP TABLE problems: Foreign key references.

From SQLZOO
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

DROP TABLE problems: Foreign key references.

schema:scott

You may not drop a table if it is referenced by another table.

DROP TABLE t_b;
DROP TABLE t_a
CREATE TABLE t_a (i INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE t_b (j INTEGER,
FOREIGN KEY(j) REFERENCES t_a(i));
DROP TABLE t_a