Redshift Alter Table Add Foreign Key

The RazorSQL alter table tool includes an Add Foreign Key option for adding foreign keys to AWS Redshift database tables. The add foreign key operation lists all of the columns of the table and allows the user to choose one or more columns to add to the foreign key for the table. It also lists the other tables available on the Redshift database so that the user can choose a referenced table and referenced column or columns.

Listed below is an example of the DDL generated by the Redshift Alter Table Add Foreign Key function:

ALTER TABLE sample.public.employee ADD FOREIGN KEY (dno) REFERENCES public.department(dnumber)

Below is a screen shot of the add foreign key function of the Redshift alter table tool.

Redshift Add Foreign Key