Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6254947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T14:16:25+00:00 2026-05-24T14:16:25+00:00

say in mysql I have a column that’s id, just int auto increment. Is

  • 0

say in mysql I have a column that’s id, just int auto increment.

Is there any way I can use php to tell me when there is an id that’s been removed?

Like say i have

5
6
7
8
10

I need it to tell me that the 9 is missing, and continue this for all the id’s. Is there any way to do this?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T14:16:26+00:00Added an answer on May 24, 2026 at 2:16 pm

    You need a table that contains all values. Then it’s simple to do a left join to find missing ids.

    create table all_values
    (id int not null) engine = myisam;
    
    insert into all_values (id) values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
    
    create table existing_values like all_values;
    
    insert into existing_values (id) values (5),(6),(7),(8),(10);
    
    select a.id from all_values as a
    left join existing_values as b
    on a.id = b.id
    where b.id is null
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say I have a table in MySQL called articles, that has a column
Say I have an MSSQL table with two columns: an int ID column that's
So let's say I have an int column in MySQL. I want to update
Say I have a mysql table, and I have a column of type enum
Let's say I have a MySQL table that is something like this: software table:
Lets say I have the following MySQL structure: CREATE TABLE `domains` ( `id` INT(10)
I have this MySQl database that has a table which contains a column that
Let's say we have a table with columns DAY and NUMERO. There can be
I have a column called CODE in a MySQL table which can be NULL.
Any help is highly appreciated. Say I have a MySQL database with a timestamp

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.