* James Gosnell > Does anyone know of a program or algorithm that will take a table > structure and update another table to the new one? Like, to just change > or add a column? What I'm trying to do is continually update the table > with different fields, or change the field types whenever I feel the > need to add a new feature or something. Thank you.
I don't know of any program, but this is how I do it: First, you can use ALTER TABLE directly on an existing table to change or add a column. <URL: http://www.mysql.com/doc/A/L/ALTER_TABLE.html > To copy the structure of an existing table: CREATE TABLE new_table SELECT * FROM old_table WHERE 1=0; The "WHERE 1=0" is to avoid copying any rows. If you want to copy the content of the table, just remove the WHERE clause. Finally, if I need to copy the table structure and keep any defined indexes, I use "SHOW CREATE TABLE MyTable;" and copy & paste the output to my text editor, where I edit the table name and any fields I need to change, before I submit it by copy & paste it back to the mysql client console. Very easy. :) -- Roger --------------------------------------------------------------------- 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