Mahalakshmi.m wrote:
> 
> I wish to perform all operations in my code with sorted order of the Name
> field.
> 

Then you should add an index on the Name column and use that to process 
your queries in Name order more quickly.

create index on MyTable(Name);

If you really insist on reordering your table, you must copy the data 
somewhere else, empty the table, and reinsert the data in the order you 
want the rowid to present. Note, this will not work if you plan on 
inserting or deleting data after this initial insert. Adding new rows 
will place then at the end and assign a large rowid, regardless of the 
Name.

create temp table t as select Id, Name from MyTable;
delete from MyTable;
insert into MyTable select Id, Name from t order by Name;

> So, to find the index of a name, which is in sorted order, I need the Rowid
> to be changed as shown in case 2 rather than in case 1.
> 

Why do you want to find the index of a Name?

Tables in SQL databases are not arrays. You don't use an index to 
retrieve the data. Tables are more like unordered sets of data.

HTH
Dennis Cote
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to