We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

move column

XK8ER
XK8ER asked
on
Medium Priority
171 Views
Last Modified: 2012-05-06
hello there,
I have one table in mysql and its like this

title
userID
message
username

is it possible to move userID at the top of title using phpmyadmin?
Comment
Watch Question

UmeshSenior Principal Technical Support Engineer
Top Expert 2009

Commented:
Try this..
ALTER TABLE table_name MODIFY userID column_type(width) FIRST;

Open in new window

Senior Principal Technical Support Engineer
Top Expert 2009
Commented:
column_type(width)  > check the column defintion and put as it is.

Here is TestCase


show create table table_name;
 
 CREATE TABLE `table_name` (             
              `id` int(11) DEFAULT NULL,            
              `hello` varchar(50) DEFAULT NULL      
            );
 
Now I'd move column hello to FIRST as
 
 
ALTER TABLE table_name MODIFY hello varchar(50) FIRST;
 
show create table table_name;
 
CREATE TABLE `table_name` (
  `hello` varchar(50) DEFAULT NULL,
  `id` int(11) DEFAULT NULL
);

Open in new window

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
UmeshSenior Principal Technical Support Engineer
Top Expert 2009

Commented:
You can run the ALTER statement in phpmyadmin's SQL query window(make sure DB name is selected in left pane)... or you can use any GUI client to run the statement.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.