how to do insert, update and delete entries in a table in postgresql

51 Views Asked by At
id name Createdat Updatedat flag
1 A 25-12-2023 01:11:15 true
2 B 24-12-2023 12:12:12 25-12-2023 14:14:14 false

I am having table like above. I am getting set of ids along with other details as a json in my input. I need to insert the ids if its not already there. Need to update the existing one. If my inputs doesnt have ids which is already present in table, then i need to delete it. How to achieve this in postgresql function

I am beginner in postgresql. I tried to delete and insert instead of update but that makes me to loose createdat data present in table

0

There are 0 best solutions below