I want to link two column of a two different table, if i update column of first table then it should automatically update to other table like :-
Master Table :- product_id, volume.
Child Table :- product_id,volume.
Master table product_id is FOREIGN KEY for child table.
is it possible if i update volume of Master table and it will automatically reflect in child table as well (and vise-versa)?
When adding in the referential integrity constraint be sure to add in on delete/update cascade.
ALTER TABLE `Table` ADD CONSTRAINT `Table_ibfk_1` FOREIGN KEY (`parent`) REFERENCES `Table` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
This will only work one way i.e. on the master table you perform an update and it will reflect this change in the child. However, this will not work if you update a child record to another value (remember that the constraint will force the child entry to update to something that already exists).