Remove Row from table and adjust Ids

Asked

Viewed 27 times

0

Greetings.

I’m a beginner in the database and wanted to know the correct way to remove an item from the table and update the identification number of the others. This is the typical novice problem, that when removing the item it defaults the entire table because the Ids jump from 1, 2, 3 to 5, this is because Row 4 has been deleted.

Note: my application is C# and I use Npgsql to make the connection with Postgresql.

  • 3

    simply does not update, the key is generated at the time of insertion and it makes no sense to change it. It’s no problem having those numbers skipped over in the ID

  • By the way, it would be a problem if you upgrade ID 5 to 4, for example.

  • imagine having 1000000 records and deleting the number 2... rsrs

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.