Dexter wrote:
>Just want to copy the table structure of a table i Have but dont have the
>the create statement and dont want to have to type it again , it has a lot
>of fields. Can I easily replicate a table.

Hi Dexter, I had the same problem and seem to remember finding the answer
hidden in the excellent MySQL book, (the Paul DuBois one).
If your table was CUSTOMERS and your new table was to be BLACKLISTED, then

CREATE TABLE BLACKLISTED SELECT * FROM CUSTOMERS WHERE 1=0;

will create the structure you want, but not put any data in it.

When you say "replicate a table", what exactly to you mean - replicate to
another system, (relatively easy), or produce a copy of a table?

If it's the latter then use the SQL above, but use "WHERE 1=1;" as the
clause to select all the data, (or don't bother with a WHERE at all,
probably simpler!). Replication between servers is covered in the online
manual.

Hope this helps.

Bob Cross, (apologies for the disclaimer that follows).



* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
This message is confidential.  It may also be privileged or
protected by other legal rules.  It does not constitute an
offer or acceptance of an offer, nor shall it form any part
of a legally binding contract.  If you have received this
communication in error, please let us know by reply then
destroy it.  You should not use, print, copy the message or
disclose its contents to anyone.

E-mail is subject to possible data corruption, is not
secure, and its content does not necessarily represent the
opinion of this Company.  No representation or warranty is
made as to the accuracy or completeness of the information
and no liability can be accepted for any loss arising from
its use.

This e-mail and any attachments are not guaranteed to be
free from so-called computer viruses and it is recommended
that you check for such viruses before down-loading it to
your computer equipment.  This Company has no control over
other websites to which there may be hypertext links and no
liability can be accepted in relation to those sites.

Scottish & Newcastle plc
Registered in Scotland, Registered Number 16288
Registered Office: 33, Ellersly Road, Edinburgh, EH12 6HX
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to