I have a MySQL database with table names like 1,2,3... upto 1000
Each tables have 2000 rows
and has the same structure.
This is how all my 2000 table's structure look like
id,url,title,content
id
has type int, primary key,auto increment.
Now I would like to create a new database with name merged
. Also a table with name merged_table
.
Can someone tell me how to import all my tables in merged_table
?
My problem here is all my tables has id
from 1 to 2000
. So I have no idea how to import them.
I would like to have unique ids from 1 to 2000000
in my new merged_table
I'm using ubuntu. So if someone suggest me a terminal command, that would be awesome.
Best Answer
Create the first table, then load each table into the merged_table:
Here is a way to script it (if the database is mydb)
Look at the output of the file
If it looks like the output I gave at the top of my answer, then run
Give it a Try !!!