DROP TABLE problems: Foreign key references.

From SQLZoo
Jump to navigation Jump to search

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
DataWars, Data Science Practice Projects - LogoDataWars: Practice Data Science/Analysis with +100 Real Life Projects