13 May 18 · npack · #teradata ·   Bookmark  

×

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);

npack

posted on 13 May 18

Enjoy great content like this and a lot more !

Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds

Copied