Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Generating ALTER TABLE code for MySQL

by jdtoronto (Prior)
on Oct 21, 2006 at 12:13 UTC ( #579755=note: print w/ replies, xml ) Need Help??


in reply to Generating ALTER TABLE code for MySQL

Some of this functionality is also available prior to 5.0 using the CREATE .. SELECT syntax.

CREATE TABLE new_tbl SELECT * FROM orig_tbl; MySQL creates new columns for all elements in the SELECT. For example: mysql> CREATE TABLE test (a INT NOT NULL AUTO_INCREMENT, -> PRIMARY KEY (a), KEY(b)) -> TYPE=MyISAM SELECT b,c FROM test2;
I know it works in 4.1 and I think it works in 4.0, but you would need to check.

jdtoronto


Comment on Re: Generating ALTER TABLE code for MySQL
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://579755]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2015-07-05 08:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (61 votes), past polls