Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

mysql modify foreign key

-- 2 Step process
ALTER TABLE tbl_name_1 DROP FOREIGN KEY fk_name;
ALTER TABLE tbl_name_1 ADD FOREIGN KEY fk_name(fk_col)
            REFERENCES tbl_name_2(pk_name) ON DELETE RESTRICT;


-- Use to find the name of the FOREIGN KEY 
SHOW CREATE TABLE tbl_name;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #mysql #modify #foreign #key
ADD COMMENT
Topic
Name
2+6 =