如何重新索引mysql表 [英] how to reindex mysql table

查看:308
本文介绍了如何重新索引mysql表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的桌子上有很多行,但是它们是乱序的.我使用字段"id"作为主键.我还有一个日期"字段,它是一个日期时间字段.

I have a table with many rows but they are out of order. Im using the field "id" as the primary key. I also have a "date" field which is a datetime field.

我该如何重新索引表,以便根据日期字段按时间顺序对条目进行编号

How could i reindex the table so that the entries are id'd in chronological order according to the date field

推荐答案

我要做的方法是创建一个具有自动增量索引的新表,然后按日期顺序选择所有旧表.然后可以删除旧表.

the way i would do it is to create a new table with auto increment index and just select all your old table into it ordering by date. you can then remove your old table.

这篇关于如何重新索引mysql表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆