Copy MySQL Table Structure & Data

Here’s a quick hit set of MySQL command-line instructions that will take create a new table in your database with the structure of an existing table and then duplicate the content as well:

CREATE TABLE new_stuff LIKE old_stuff;
INSERT new_stuff SELECT * FROM old_stuff;

This is a great and quick way to make dummy tables of data for testing purposes or for making regular table backups inside your own database for easy comparison or a million other uses that come up every day when working with databases.

April 21st, 2009 | MySQL | 0 Comments

MySQL 5 Hates Your Left Joins

When you upgrade MySQL from 4 to 5 there’s a decent chance you’re going to be seeing some Error #1054 action on any query with a left join.

There’s a description and solution available at CodingForums.com.

November 15th, 2006 | MySQL | 0 Comments