C
C
Chronic 862018-10-28 13:39:22
SQLite
Chronic 86, 2018-10-28 13:39:22

How is insert into linked tables implemented?

How to implement insert into related tables?
Peoples (Id, Name)
Places (Id, Place)
Location (People_id, Place_id)
Add a new person and a new place at the same time. Now I'm solving this head-on, adding a person and a place, pulling out the last IDs from these tables and doing an insert into the location table. Accordingly, there is no multithreading.
How else can this problem be solved?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg Barabanov, 2018-10-29
@olegbarabanov

One of the possible options for you is to create a view (VIEW) and assign a trigger to this view on INSERT. In the body of the trigger, post all the records you need to the tables you need.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question