ronniefalk

September 20, 2010

Resolution: teach you to master how to change the table column order

Filed under: Uncategorized

First, consider whether it really need to change the table column order. The core elements of SQL from the data storage format for applications. General shall designate the order to retrieve data. In the following section a statement to col_name1, col_name2, col_name3 order to return out; in section 2 statement to col_name1, col_name3, col_name2 order to return the column:

mysql> SELECT col_name1, col_name2, col_name3 FROM tbl_name;

mysql> SELECT col_name1, col_name3, col_name2 FROM tbl_name;

If you decide to change the order listed, perform the following steps:

Column with a new order to create a new table.

Implementation of the statement:

mysql> INSERT INTO new_table

-> SELECT columns-in-new-order FROM old_table;

Remove or rename old_table.

Rename the new table to the original name:

mysql> ALTER TABLE new_table RENAME old_table;

SELECT * is very suitable for testing queries. However, in the application, never rely on the use of SELECT * Do not rely on search out according to their location. If you add, move or delete a column, the column returned by the order and location will remain the same. A simple change on the table structure will cause the application to fail.

Recommended links:

CATIC Shenzhen: HR reform activity trip

Directory Web Development

flash to MPG

Visuanl C # 2005 Quick Start of the while statement (1)

E-cology in the Pan Micro Series 29

Evaluate Project Management

Dynamic Change CBA Button

Real player iphone

Mts Conversion

Animation with Fireworks

SYBASE Services

“Chino conflict” Comment

BLACKBERRY format

Comments »

The URI to TrackBack this entry is: http://ronniefalkus.blogsome.com/2010/09/20/resolution-teach-you-to-master-how-to-change-the-table-column-order/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



Anti-spam measure: please retype the above text into the box provided.

Get free blog up and running in minutes with Blogsome
Theme designed by Gary Rogers