MySQL Forums
Forum List  »  InnoDB

Re: Possible constraint creation
Posted by: GARY BARBER
Date: November 23, 2015 06:20AM

I thought that it should work like that but I must be using the incorrect creation statement. This is what I used:
Table1 is the sub_dept table and table2 is the dept table.

ALTER TABLE `table1` ADD CONSTRAINT `fk_dept_id_sub_dept`
FOREIGN KEY (`dept_id`) REFERENCES `table2` (`dept_id`);

Thanks!

Options: ReplyQuote


Subject
Views
Written By
Posted
1478
November 20, 2015 11:56AM
688
November 20, 2015 12:20PM
Re: Possible constraint creation
797
November 23, 2015 06:20AM
757
November 23, 2015 01:00PM
744
November 23, 2015 07:01AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.