Home  • Database • MySQL

Permanent reorder MySQL table records on specific column

MySQL
create table student_tmp select id, name, phone, email from student order by name;

alter table student_tmp modify column `id` int(10) primary key unsigned not null auto_increment;

drop table student;
alter table student_tmp rename to student;

Comments 0


Copyright © 2024. Powered by Intellect Software Ltd