devilcrab
devilcrab

Reputation: 139

How to use insert, update, delete query in sql at same time?

Just stuck up, how to use multiple query in single form to execute different query.

eg:

enter image description here Like in image, Table 1 has records.

what i am doing is:

extract first 3 record from table 1 and show in a form (frontend) and when this process is gone..

i need at same time , this happens without refresh and without user data or any frontend disturbance.

Once this data view to user:

i need:

same time, those 3 records get copy to table 2 from table 1. like Roll_no and Name.

Then, remove those 3 records from table 1.

i am doing this to prevent duplicate data and something.

so any code will be helpful.

Upvotes: 1

Views: 1231

Answers (1)

Ivaylo Strandjev
Ivaylo Strandjev

Reputation: 70989

Your question is quite unclear, but it seems you are concerned about data integrity performing multiple queries. What you need is to use transaction to group a set of commands toghether. This way either all commands will succeed or your database will not be affected by any of them.

Upvotes: 2

Related Questions