This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
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)?
Do I understand it right, that the volume in a child record should always be the same as the volume in the master record? And then you update a child of the master record, the other children of the same master record (the child's "siblings") should be updated as well?
If this is so, the best thing to do would be to remove the volume column from the child table altogether. If you need to read the volume together with other attributes of the child table, you'll use joins. You might need to modify your business logic to some extent (modifying the volume in the child record might need a rethought), but your data model will not have a flaw that needs fixing with triggers.