MySQL Rocks!

Wow I just found a really cool feature!  You can copy and entire table and all the data from one table to another in MySQL very easily!

CREATE TABLE newtable SELECT * FROM oldtable;

Done!  Or if you JUST want to copy the table structure:

CREATE TABLE newtable SELECT * FROM oldtable WHERE 1=0;

Leave A Reply - 2 Replies
Sam Smith 2007-01-23 05:45am - sam@... - Logged IP:

You can do this in practically any DB. MySQL is many things. 'Cool' is most certainly not one of them.

Nzzzzz 2007-05-17 10:35pm - No Email - Logged IP:

Oh, harsh! MySQL is many things, and Cool is most definitely up there. Granted it doesn't yet have the feature set of Microsoft SQL Server or Oracle, but, given the massive ammount of cash and hassle you'll expect to acquire a license for one of those, MySQL does start looking better and better. There's a reason why it's one of the most popular web hosting databases in the world.

All content licensed under the Creative Commons License