Wednesday 15 July 2015

sql - Filling empty auto increment values -



sql - Filling empty auto increment values -

i've got table structure:

|id|name|

id incrementing when add together new row in table. illustration i've got 3 rows:

1|john 2|bob 3|alice

if delete row id 2 there that:

1|john 3|alice

how insert new row id = 2 if won't know id's empty? (or - how insert rows unused id (auto increment) values?) thanks.

from documentation:

on insert, if rowid or integer primary key column not explicitly given value, filled automatically unused integer, 1 more largest rowid in use. true regardless of whether or not autoincrement keyword used.

in other words, should able specify id explicitly when performing insert , won't autoincrement.

sql sqlite sqlite3

No comments:

Post a Comment