John Mistler wrote:
Is there a way to make an exact copy of a table and give the copy a new
name?
Thanks,
John
From the doc :
As of MySQL 3.23, you can create one table from another by adding a
SELECT statement at the end of the CREATE TABLE statement:
CREATE TABLE new_tbl SELECT * FROM orig_tbl
I have a table tbl_version_history which has a primary key and an index.
Through this query I am able to create a copy tbl_version_history_copy with
all the index.
Just replace the stuff with yours and probably it will help.
create table `tbl_version_history_copy` ( primary key ( FLD_REG_NUM )
At 11:10 -0700 10/15/02, David Yee wrote:
>Hi all. What's the quickest way to copy a table so that all column
>attributes such as auto_increment and primary key along with all indexes get
>copied over? I like using:
>
>create table new_table select * from old_table
>
>But it doesn't copy any ind
* Bogdan Stancescu
> No, I mean the type of the fields. When you create a table you
> have to define the field types -- char, varchar, stuff like
> that. Does your code take care of that?
It seems like it does:
mysql> use test
Database changed
mysql> create table test4 (a char(8),b int(9));
Quer
No, I mean the type of the fields. When you create a table you have to define
the field types -- char, varchar, stuff like that. Does your code take care of
that?
Thanks for the links!
Bogdan
Roger Baklund wrote:
> * Bogdan Stancescu
> > I'm curious about this issue too - does the third line i
* Bogdan Stancescu
> I'm curious about this issue too - does the third line in your
> code take care of the table structure as well?!
>
> I'm also wondering how one could duplicate a whole database (for
> backup purposes in my case).
> Roger Baklund wrote:
> > create database new_db;
> > use new_
I'm curious about this issue too - does the third line in your code take care
of the table structure as well?!
I'm also wondering how one could duplicate a whole database (for backup
purposes in my case).
Bogdan
Roger Baklund wrote:
> * saraswathy saras
> > how to copy table from one database
* saraswathy saras
> how to copy table from one database to another database,is it possible.
If the table type is MyIsam, you can copy the tables on the OS level.
You can also execute some commands like these:
create database new_db;
use new_db;
create table new_table select * from old_db.old_t
> Can I copy a table (structure only) to another database? I've searched
> though my manuals without success so far.
use phpMyAdmin. It is a push of a button (you have to give a name
for the copy first).
--
Herzlich
Werner Stuerenburg
___
On 04-Jul-01 Graham Nichols wrote:
> Hi,
>
> Can I copy a table (structure only) to another database? I've searched
> though my manuals without success so far.\
$ mysqldump -d db da_table | mysql newdb
Regards,
--
Don Read [EMAIL PROTECTED]
-- It's always
When I need recreate a table structure I do it like
CREATE db_target.table_copy
SELECT * FROM db_source.table
WHERE 1=0;
The only thing that you have to do now is
DESCRIBE db_target.table_copy;
DESCRIBE db_source.table;
Since you need to manually reestablish the indices in the new table.
Alt
GN> Hi,
GN> Can I copy a table (structure only) to another database? I've searched
GN> though my manuals without success so far.
you can use query
show create table TABLENAME
which will show what query recreates table named TABLENAME
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
12 matches
Mail list logo