Just a collection of MySQl tips that I always seem to be looking up on the net.
I always forget these, and have to look ‘em up on the net. So I’ll start a collection here.
Copy table structure:
CREATE TABLE newtable LIKE oldtable;
Copy table structure and data:
CREATE TABLE newtable LIKE oldtable; INSERT INTO newtable SELECT * FROM oldtable;
or
CREATE TABLE newtable SELECT * FROM oldtable;
Show table structure:
SHOW CREATE TABLE tablename;