Dennis Cote wrote: >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); Thanks a lot Dennis. My process is more fast by means indexing. Dennis Cote wrote: >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. Ya. Right now each time when I insert or delete I will drop the tbl and insert once again like: create temp table t as select Id, Name from t order by Name; I think no other way than this will work out. Mahalakshmi.m wrote: > 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. Dennis Cote wrote: >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. Bcoz in my Application as input - I will give the starting letter say 'c' Then as output - I need the rowid of the name that is starting with 'c' if no name starts with that character then the rowid of the name which is next should be provided along with the name. For eg, I will create one temp tblb where I will store the name in sorted order itsef s follows: Rowid id name 1 4 aaa 2 2 bb 3 1 eee 4 3 zzz Input for my application is - c Required output is - rowid -3 and name - eee I will use the following querry: Select rowid,name from tbl where name >= 'c'; Think this gives a clear idea abt my requirement. Thanks & Regards, Mahalakshmi.M _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users