I have one database with a bunch of big tables in it. I would like to separate it into 4 different databases by moving tables from the big database to the others that I will create.
Any thoughts on the easiest way of doing this?
Sending tables between databases
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Code: Select all
CREATE TABLE `newDatabase`.`newTable` LIKE `oldDatabase`.`oldTable`Code: Select all
INSERT INTO `newDatabase`.`newTable` (`field1`, `field2`, .. `fieldn`) SELECT `field1`, `field2`, .. `fieldn` FROM `oldDatabase`.`oldTable`- dibyendrah
- Forum Contributor
- Posts: 491
- Joined: Wed Oct 19, 2005 5:14 am
- Location: Nepal
- Contact:
Alternate way
Without field can also be done if all fields are to be copied.
Cheers,
Dibyendra
Code: Select all
INSERT INTO `database`.`new_table` SELECT * FROM `database`.`old_table` ;Dibyendra