sql - How to renumber a table column -
I have a SQLite table sorted by column id
but let me call it runtime Need to sort by another numeric field named
table pass_2
looks
create table pass_2 As SELECT RunTime, PosLevel, PosX, Posy, Speed, ID is good, but I have to record the id
column without recording it from 1 .. n
. This is a principle of SQL database that is not a natural or guaranteed command in the underlying tables
To enter SELECT
ing from the table using the ORDER BY
section for your records, you must specify the order in which you want to view.
You can get your code from the SELECT * to ORDER using the runtime
, and this is the correct and reliable way to do this in any SQL database.
If you want to try to get the record in "code" for the "code" in runtime, you can call ORDER BY
Use to create the table in SELECT
, but remember: You do not guarantee to get the record back in the order in which they are included in the table .
When can you get back the record in a different order? This is most likely to be done when your query can be answered using a column in a cover index - in that case the record is more likely to return to the index order than any "natural" order (but again , by order
section).
Comments
Post a Comment