13 May 2018        Add to Favorites   Report

Adding FOREIGN KEY to a table in Teradata using ALTER table

Use Alter table command to add referential integrity constraints to a table


 Syntax:

ALTER TABLE TABLE_NAME ADD FOREIGN KEY (column_from_this_table) REFERENCES tbl_name_that (column_in_that_table);


Example:

ALTER TABLE HAPPY_EMPLOYEES ADD FOREIGN KEY (DeptNo) REFERENCES tbl_dept(department_number);

Read great educational content like this and a lot more ! Create my free account now 🎁

Copied