mardi 8 mars 2016

sqlite rowid after deleting rows

I created sqlite table tmp with columns id,name.

CREATE TABLE if not exists tmp ( id INTEGER PRIMARY KEY, name TEXT NOT NULL);

I inserted 5 rows in it.

When I run select query with rowid column it gives below output. select rowid,id,name from tmp;

rowid id name 1 1 a 2 2 b 3 3 c 4 4 d 5 5 e

Now I delete rows with id 3 and 4 and run above query again.

rowid id name 1 1 a 2 2 b 5 5 e

Now my problem is rowid not getting reset and holes.

Even after doing vacuum, it still doesnt reset rowid, it still gives above output.

The output which I want is

rowid id name 1 1 a 2 2 b 3 5 e

Can anybody help me in achieving above output?

Thanks

Aucun commentaire:

Enregistrer un commentaire