N
N
Neonoviiwolf2020-12-13 15:55:28
PostgreSQL
Neonoviiwolf, 2020-12-13 15:55:28

How does update work for related tables?

Kind
There is a Postgresql database with related tables (1 to 1, so 1 to many). It comes to the server that it is necessary to update table A, which is associated with table B, in table B there are 3 rows that are associated with row A.
In the update for table A, there are 2 rows of table B. The
desired behavior is that 2 rows are updated in table B , and the third one was removed.
Now I am writing a functional for working with the database and soon I will need to implement update, I would like to know if it is easier to delete table A and just create a record again with the same id, or is it possible to specify the behavior I want in the database?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question