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]
-----------------------------------------------------------------------------

Reply via email to