Dropping a table that is referenced by another table through a foreign key constraint

create table departments
   dept_id   integer not null primary key,
   name      varchar(50) not null 

create table employees
   emp_id      integer not null primary key,
   dept_id     integer not null references departments,
   last_name   varchar(50) not null,
   first_name  varchar(50)

-- drop departments without manually dropping the foreign key from employees:
drop table departments cascade;

Without this feature, the FK must be dropped manually (alter table employees drop foreign key ...;)

Back to the SQL Feature Comparison