phpmyadmin

Is there a way t build a new table in phpmyadmin from an existing table making the table structure identical?

I need a table like that where I will add one new column, but all the rest is identical.

Thanks
Richard KortsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dsackerContract ERP Admin/ConsultantCommented:
Use a query statement like this:

SELECT TOP 0 *
INTO MyNewTable
FROM MyOldTable

Open in new window

After you do that, then you can add your one new column at whatever point is applicable.

ALTER TABLE MyNewTable
ADD MyNewField varchar(50)

Open in new window

Or whatever size and type you really want.
0
Richard KortsAuthor Commented:
It fails & gives this message (whick I think is a catchall):

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0 *  INTO ttask  FROM cl_task  LIMIT 0, 30' at line 1

The EXACT query I used is:

SELECT TOP 0 *
INTO ttask
FROM cl_task

ttask does not exist; do I have to create an empty table first?
0
dsackerContract ERP Admin/ConsultantCommented:
Ick, I used SQL Server syntax. You're on MySQL, sorry.

Try this:

CREATE TABLE MyNewTable LIKE MyOldTable

Open in new window

.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dave BaldwinFixer of ProblemsCommented:
In phpMyAdmin, select your database and table.  One of the tabs across the top is 'Operations'.  Click on that and one of the functions on that page is 'Copy table to ...' with several options.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.