如何以永久方式对MYSQL表进行排序? [英] How to sort a MYSQL table in a permanent way?
本文介绍了如何以永久方式对MYSQL表进行排序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的桌子上有Symbol和Weight列(只有两列). 我需要根据符号的权重对表格进行排序,这可以通过
I am a having a table with column Symbol and Weight(only two Column) . I need to sort table according to weight of the symbols, that i can do by
SELECT symbol, weight FROM symbols ORDER BY weight DESC
但是这不会改变我的表,但是会给我一个排序的输出(临时的).
but this wont change my table, but it will give me a sorted output(temporary).
我想对表格进行永久排序.我该怎么办?
I want to sort table permanently. How can i do that?
推荐答案
您可以使用ALTER TABLE
You can do this with ALTER TABLE
f.e.
ALTER TABLE tablename ORDER BY columnname ASC;.
但是请注意,在插入和删除之后,表并没有保持该顺序
but be aware that the table does not remain in this order after inserts and deletes
这篇关于如何以永久方式对MYSQL表进行排序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文