- 1
Open your SQL server's command-line utility and connect to the database. Consult your server's documentation for instructions on connecting. You must have an administrative-level account for the database table you are trying to modify.
- 2
Select the proper database on the server. Type "use database <dbname>;"
- 3
Alter the position of the columns based upon the order you want them to appear in, starting from No. 1. For example, to make the table row's identification number ("id") the first element and the first name of the user the second element, type the command:
ALTER TABLE users ALTER id POSITION 1; ALTER TABLE users ALTER first_name POSITION 2.
5/15/11
How to Change the Column Order in Alter Table
Structured Query Language is a way to communicate with a database and make it perform actions on the data and the relational structure that it manages. When you have a database with improperly ordered columns, it is still perfectly usable, but it can seem illogical and cumbersome to try to work with any ordered queries or to perform quick browsing of the raw data. You can fix this by changing the order columns appear with. You must do this using the ALTER TABLE statement.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment