How to Develop Script to Move Data between Mysql Tables

Asked By 10 points N/A Posted on -
qa-featured

I have a large number of Mysql database tables. I need to move some records around from one table to the other but I do not know how to go about this. Please help me with you expertise to move data from one table to the next. What kind of script should I develop and what specific commands can accomplish this task?

SHARE
Answered By 0 points N/A #190744

How to Develop Script to Move Data between Mysql Tables

qa-featured

To Transfer the data from one tale to another table by following methods:

** The INSERT INTO method

** The BCP/Bulk Insert method

** SELECT INTO method

The INSERT INTO method works with the following methodology

INSERT INTO Table2 ( <Columns>)

SELECT <Columns>

FROM Table1

WHERE < condition>

DELETE FROM Table1

WHERE<condition>

COMMIT;

The above is the simplest method

** The The BCP/Bulk Insert method copies data from one table to another in two steps.

1. Use BCP to extract the data and make it a text file.

2. Using BULK INSERT command transferring the records into the destination file.

** SELECT INTO method is used when previously created table is not there and wants the data to be transferred from one table to the newly created table.

SELECT <columns>

INTO tablename

Related Questions