At 04:26 PM 11/2/2001 -0600, Paul DuBois wrote: >At 2:12 PM -0800 11/2/01, Bennett Haselton wrote: >>How do you change the order of columns in MySQL tables? I assume the >>tables have a concept of column order, since the DESCRIBE command always >>lists the columsn in the order in which they were created. >> >>I figured that the place to look would be the syntax page for the ALTER >>TABLE statement: >> http://www.mysql.com/doc/A/L/ALTER_TABLE.html >>but there's nothing there about how to change the order of columns. > >You can specify the position with a FIRST or AFTER col_name clause >when you add a column, but not (as far as I know) change the position >of an existing column. > >Do you have some weird application requirement that makes this necessary? >You can always name the columns in the order you want them to come >out, when you issue a SELECT query.
I know it's bad practice for an application to depend on the order of columns within a table; I'm avoiding that. The only reason I cared about order was because, in the Web-based interface that I'm writing for my own use, one of the functions is to dump the contents of a MySQL table into a viewable HTML table. When viewing that output, it's helpful if the columns are organized into some meaningful order. -Bennett [EMAIL PROTECTED] http://www.peacefire.org (425) 649 9024 --------------------------------------------------------------------- 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