I have one master
table having column keywords varchar(120)
as Unique and it is reference to another table **cmp_keywords**
as a foreign key. Now how can I edit the column keywords
value from master
table and cmp_keywords
table?
Define your foreign key with the option ON UPDATE CASCADE
. Then just update the master table (correct term is parent table), then your child table will be updated automatically.
From the top of my head
ALTER TABLE cmp_keywords DROP FOREIGN KEY <foreign_key_name>,
ADD FOREIGN KEY my_new_fk_name (cmp_keywords_column) ON UPDATE CASCADE REFERENCES master_table(keywords);
should do it. If not, figure out the correct syntax with this link .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.