Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 161
  • Last Modified:

move column

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?
0
XK8ER
Asked:
XK8ER
  • 3
1 Solution
 
UmeshCommented:
Try this..
ALTER TABLE table_name MODIFY userID column_type(width) FIRST;

Open in new window

0
 
UmeshCommented:
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

0
 
UmeshCommented:
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.
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now