Jump to content

Recommended Posts

If you just want to copy the data, you can use

 

CREATE TABLE foo SELECT * FROM bar

 

If you want an exact copy including indexes and so on, I can't help you there.

Actually there's a "create table like" option to get the structure... and then you can simply insert into... select where 1=1.

If you just want to copy the data, you can use

 

CREATE TABLE foo SELECT * FROM bar

 

If you want an exact copy including indexes and so on, I can't help you there.

 

wat is meant by indexes? thanks

Seriously? Then read all the stickies first before posting anything else or ever working on a database.

  • 2 weeks later...

If you just want to copy the data, you can use

 

CREATE TABLE foo SELECT * FROM bar

 

If you want an exact copy including indexes and so on, I can't help you there.

 

how to show the progress bar? eg 1% to 100% ?

 

Progress bar in mysql?

 

$sql = "CREATE TABLE $new_table SELECT * FROM template";

it wont set the primary key in the duplicate table ......how to solve it? set it manually ?

thanks?

I didn't realize that was possible, to make a new table and copy the data in one step....

 

and it also wont copy the engine....still myisam engine  :-\

Since I don't know that original table looks like, it's hard to guess.

$sql = "CREATE TABLE pyrmain


		(
		PID integer(10),
		Serialnum varchar(10),
		UplineSerial varchar(10),
		UplinePID integer(10),
		Downleft integer(10),
		LeftSerial varchar(10),
		Downright integer(10),
		RightSerial varchar(10),
		RowNum integer(10),
		ColumnPosi integer(10),
		ColumnTotal integer(10),
		DownlineAmount integer(10),
		Initial varchar(10),
		ActivateTime datetime,
		Status varchar(10),
		UserID varchar(10),
		ExpiredDate datetime,
		CreateDate datetime,
		Golden varchar(10),

		Primary Key (PID)    	    
		)engine=innodb";

 

how to duplicate the primary key and the engine  as well?

thanks

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.