arrow_backwardBack to Amazon Redshift code examples

Amazon Redshift How to remove a foreign key (or constraint) from an existing table

Removing a foreign key (otherwise known as a relation or association) from a Amazon Redshift table. Note that after removing a relation, you might also want to remove any left over indexes.
ALTER TABLE
  "users" DROP CONSTRAINT "department_id_fk_constraint"

Using Beekeeper Studio?

Beekeeper Studio is a free and open source database manager for Windows, Mac, and Linux.

This feature is baked right in, so there's no need to manually type SQL every time. Access foreign key editing by right-clicking on a table in the sidebar and clicking 'View Structure', then click 'Relations'.

Download Beekeeper Studio