Hi Lokesh, Thanks for your suggestions.
My proble is assigning a unique record for each record in a table. The database table name MUSIC. I have 3 columns Artist Album and Tracks. Artist1 Album1 Track1 Artist2 Album2 Track2 Artist3 Album2 Track3 I need to assign a unique id value for each item in the row. For example Artist1 with id = 100, Album1 id = 200 Track1 id = 300 Artist2 with id = 101, Album2 id = 201 Track2 id = 301 Etc. How I can achieve in assigning a unique id for each and every item. One more problem: I want to restrict the Artist range to 100 to 199 so that with the id I can make my search fast and also I knew with unique id that I need to search for the Artist alone. Thanks & Best Regards, A.Sreedhar. -----Original Message----- From: Babu, Lokesh [mailto:[EMAIL PROTECTED] Sent: Monday, August 20, 2007 6:27 PM To: sqlite-users@sqlite.org Subject: Re: [sqlite] Unique ids for each record refer *In-Memory Database: Delete rows on a Table increases the memory usage * More help needed or didn't understand, let me know. On 8/17/07, Sreedhar.a <[EMAIL PROTECTED]> wrote: > > Thanks Marcus!!!! > > > > I am working in 3.3.6 version. > > I created a table with id as integer primary key and with constraint id<6. > > > > For eg, > "create table Test(id INTEGER PRIMARY KEY CHECK (id > 0 and id < > 6),name integer);" > > "insert into Test (name) values('name1');" > "insert into Test (name) values('name2');" > "insert into Test (name) values('name3');" > "insert into Test (name) values('name4');" > "insert into Test (name) values('name5');" > > The output for :"select rowid,* from Test;" > Rowid id name > 1 1 name1 > 2 2 name2 > 3 3 name3 > 4 4 name4 > 5 5 name5 > > Now I deleted 2 records. > > "delete from Test where id=3;" > "delete from Test where id=4;" > > "vacuum Test;" > > The output for :"select rowid,* from Test;" > > Rowid id name > 1 1 name1 > 2 2 name2 > 5 5 name5 > > > > My doubt is > > . if I tried to insert one more file ,I cant able to insert.error > like "constraint failed" flashes.Since I deleted 2 records that space > is freed only.i tried after doing vacuum also.Is there any other way > to insert. > > > > . The rowid is also not updated after doing vacuum.Is there any > other way to update.If I tried the same by creating a table with > INTEGER alone at that time rowed is updating properly after "Vacuum Test". > > Can any one please clarify my doubts. > > > > Best Regards, > A.Sreedhar. > > > -----Original Message----- > From: Markus Hoenicka [mailto:[EMAIL PROTECTED] > Sent: Thursday, August 16, 2007 7:39 PM > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] Unique ids for each record > > I assume you'd rather want three separate tables (artist, album, > track) with an autoincrementing ID field per table. Your approach > would not allow users to own more than 100 albums. > > regards, > Markus > > Quoting "Sreedhar.a" <[EMAIL PROTECTED]>: > > > Hi, > > > > I have a table with 3 columns. > > > > Artist Album and tracks. > > > > Can i fix a range of ids for each column like 1-100 for Artist > > 101-200 for Album and 201-300 for tracks > > > > So that I can have a unique number(id) for each record. > > > > Will there be a problem while deleting and inserting the records? > > > > Thanks and best regards, > > A.Sreedhar. > > > > > > > > > > > > -- > Markus Hoenicka > [EMAIL PROTECTED] > (Spam-protected email: replace the quadrupeds with "mhoenicka") > http://www.mhoenicka.de > > > > ---------------------------------------------------------------------- > ------ > - > To unsubscribe, send email to [EMAIL PROTECTED] > > ---------------------------------------------------------------------- > ------ > - > > > > > > ---------------------------------------------------------------------- > ------- To unsubscribe, send email to > [EMAIL PROTECTED] > > ---------------------------------------------------------------------- > ------- > > ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------