13 May 18 · npack ·       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);

npack

posted on 13 May 18

Read great educational content like this and a lot more !

Members get free exclusive access to content, new courses, and discounts. Signup for a free account to write a post / comment / upvote posts. Creating an account takes less than 5 seconds and you can start earning badges & points too

Copied