Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Is it possible to override IDs in a database?

Featured Replies

Hello!

 

 

I’m a noob and need advice. I’m running a site where users can submit a benchmark score for their computer. Every score is one entry and has an ID. My problem is that when I delete a score, the score posted after that would not take its ID but the number after that.

 

Example: I submit a score with the ID 10. I delete it for whatever reason. Now I post another score, and it should have the ID 10, but instead, its ID is 11.

 

My developer says it’s not possible to do that because otherwise we wouldn’t know what number to assign to future scores.

 

 

This bugs me because I would like the IDs to hint how many submissions there are (and I don’t want another, separate function for that). I just don’t want an ID of 350 make people think there are 350 submissions when in reality there may only be 200.

 

So what can we do about this? Can you recommend me a solution, so I can recommend it to my developer?

 

Thank you very much in advance!

There was a question similar to this on the r/php board on Reddit other day https://www.reddit.com/r/PHP/comments/b1i7rn/hey_guys_im_creating_blog_with_phpsql_database_my/

You might not be using PHP, but it is still relevent and it will answer your question in a far better way then I coul

 

There are plenty of cases where you want the primary key to remain to avoid queries outputting incorrect data in the future. For example, looking up a value and getting the wrong entry because of an ID change. Auto increment is a good thing. If you're deleting rows out of the database, you can still see how many entries you have by totaling the amount of remaining rows instead of relying on the primary key.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.