Hello everyone,
I am a newbie to this community and am quite impressed by the discussions carried out.
So, I just thought this would be the right place to ask SQL doubts although the problem is with MySQL.
My problem is:
I need to insert thousands of records in 2 tables A, B.
Now table A has a column index_no, an auto-incrementing column.
When I insert any row in table A, I want that the row in table B should be inserted using the index_no in table A.
One approach that I am using is,
Insert a record in table A, get the Index_No value and insert the record in table B with this index_No.
However for every set of records, there are 3 queries being executed -- insert in A,select from A and insert in B.
For 10000 records, this figure is 10000*3 = 30000.
Is there any better way to do it. (like LOAD LOCAL DATA in FILE)
Thanks
Akash