In SQL :
If you want to move id
column to the first place, we have a query for that
, is like below:
ALTER TABLE `mydatabase` CHANGE `id` `id` INT NOT NULL AUTO_INCREMENT FIRST;
In this query, information is like below:
- mydatabase : your table name.
But if you want to move a column after another column
, mean maybe your A column is at the secound and you want to move it to the last place of your table after B column so use this query:
ALTER TABLE `mydatabase` CHANGE `title` `title` VARCHAR(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL AFTER `img_name`;
The information of this query is like below:
- mydatabase: your database name is here.
- title: is your column, that
you want to move (A column).
- img_name: the secound column (B column).
- The title type is : VARCHAR(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL ( maybe yours is different type)
In PHPMYADMIN :
- From sidebar, click on
+
inside of your table, click on COLUMNS
.
- It open a table with all name of columns. Click on
change
under
column action
(column you want to move). Now you see another page,
- the last item is
Move column
. It is select option and choose place
you want to move that column.
- Choose and click on
save
button.
I hope it be usefull. if you found usefull, please upvote. Thanks.