MySQL Forums
Forum List  »  Newbie

Re: issues with foreign key constraint ERROR 1005
Posted by: Zach Ellis
Date: November 03, 2023 11:47AM

Hello Jon

This might be a dumb question that I have.

for the formatting of code does that go with all links? or should i use a [LINK] tag for links

ex
[LINK] https://stackoverflow.com/questions/12994919/errno-121-duplicate-key-on-write-or-update


is this how it should be used.
ALTER TABLE `TCTSandpit`.`tbl_Emp_Expences`
ADD CONSTRAINT `Emp_ID`
FOREIGN KEY (`Emp_ID`)
REFERENCES `TCTSandpit`.`tbl_Emp_Details` (`Emp_ID`)
ON DELETE CASCADE
ON UPDATE CASCADE; 

or should we have the code in the brackets

[CODE
ALTER TABLE `TCTSandpit`.`tbl_Emp_Expences`
ADD CONSTRAINT `Emp_ID`
FOREIGN KEY (`Emp_ID`)
REFERENCES `TCTSandpit`.`tbl_Emp_Details` (`Emp_ID`)
ON DELETE CASCADE
ON UPDATE CASCADE; 
]

or should there be a 
 tag at the start of the code and one at the end.

ALTER TABLE `TCTSandpit`.`tbl_Emp_Expences`
ADD CONSTRAINT `Emp_ID`
FOREIGN KEY (`Emp_ID`)
REFERENCES `TCTSandpit`.`tbl_Emp_Details` (`Emp_ID`)
ON DELETE CASCADE
ON UPDATE CASCADE;

Thank you for your time
Zach Ellis

Options: ReplyQuote


Subject
Written By
Posted
Re: issues with foreign key constraint ERROR 1005
November 03, 2023 11:47AM


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.