DROP TABLE problems: Foreign key references.

From SQLZOO
Revision as of 09:43, 17 July 2012 by Marek (Talk | contribs) (Created page with "DROP TABLE problems: Foreign key references. <div class='ht'> <div class=params>schema:scott</div> <div> You may not drop a table if it is referenced by another table. </div> ...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, 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