I have two tables: one is foreign reference table lets say table a and other one is the data table lets say table b. Now, when I need to change the data in table b, but I get restricted by table a. How can I change "rid" in both tables without getting this message?
"ERROR: insert or update on table "table a" violates foreign key constraint "fk_boo_kid" SQL state: 23503
Detail: Key (kid)=(110) is not present in table "table b".
Example query to update both tables:
UPDATE table b table a SET rid = 110 WHERE rid =1
table b +-----+-------+-------+ | rid | ride | qunta | +-----+-------+-------+ | 1 | car | 1 | | 2 | bike | 1 | +-----+-------+-------+ table a +-----+-----+------------+ | kid | rid | date | +-----+-----+------------+ | 1 | 1 | 20-12-2015 | | 2 | 2 | 20-12-2015 | +-----+-----+------------+