Answer the question
In order to leave comments, you need to log in
What is the best way to insert into a database?
The situation is this. There is PostgreSQL. There is a JSON whose fields correspond to the database schema and which I turn into an INSERT statement. those.
{
id: 123,
price: 824,
objs: [{ name: "apple"}, { name: "milk"}, { name: "water"}]
}
REMOVE from mainTable WHERE id=123 -- удаляем из главной таблицы
REMOVE from obj WHERE id=123 -- удаляем из второй таблицы
INSERT INTO mainTable ...
INSERT INTO obj ...
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question