Article | October 17th, 2008

How to copy the contents of one table to another using SQL is not immediately obvious.

Create and Populate Table

create table mytablecopy select * from originaltable

Copying a Table into an Existing Table

insert into originaltable select * from mytablecopy

Sub-Selects

MySQL doesn’t yet support sub-selects. For example you cannot do this:

    select * from things where thing.userid not   in (select userid from
otherthings)

There are no comments yet, add one below.

Leave a Comment


You must be logged in to post a comment.