|< < 33 > >|

Deleting tables


drop table t;

Deleting tables connected by foreign keys

Suppose we have two tables connected by a FK:
create table artist( artist_id int not null primary key, name varchar not null, website varchar default null); create table album( album_id int not null primary key, artist_id int not null references artist, title varchar not null, year int not null check(year > 0), label_id int not null);

  • We want to drop both tables.

  • In what order should the tables be dropped?

|< < 33 > >|