postgresql
So i am inserting a row in a table1 and this row contains one field which is a field in table2. So i would like to create a function which will insert a row in table2 when i am inserting a row in table1. So example: I have two tables
table1
....
....
....
table2
....
....
....
I insert in table1 Insert in table1 values ("Sam","USA"); as a result i want to have
table1
Sam Usa
...
...
...
table2
Usa ...
...
...
So what function should i write and what trigger? Also if there is a row in table2 which has a field USA, this function should not insert one more row with USA
Sorry, if i explained it to complicated