Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
537 views
Welcome To Ask or Share your Answers For Others

1 Answer

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...