I have a database named info. In the database I have 4 different tables info1, info2, info3 and info4.
I want to create a stored procedure so that whenever I make changes in table info1 (like INSERT, DELETE or UPDATE) the same changes should appear in the other three tables.
I am using PostgreSQL for this and I don’t know how to perform this query.
Please explain it with an example.
Thanks in advance!
Basically you need to read the manual to understand what you are doing. @Michael provided links.
There are many different ways how you can go about this. Here are two typical examples for
UPDATEandDELETE:Create trigger function for UPDATE:
Create the trigger making use of it:
For DELETE: