php - SQL ID value auto move up -
I have a table that is an auto-inferit ID column. I want my database to automatically update the ID value To be changed, so that always have an ID value of 1. For example:
id first name last name 1 John Smith 2 Charlie Jacobs 3 Jason Young I want it so much that if I enter the line ID 1 If I remove it, then I changed the ID in ID1 and ID 2 to ID id 2. This way:
ID Firstname Last Name 1 Charlie Jacobs 2 Jason Young I would like to add a name followed by ID3. Preferably I was wondering if there was any setting in SQL which could do this automatically, if this is not possible then a PHP script would be the second best thing.
This is not the right thing to do. Why do you want to do this? If this corrupts your primary key values then do not do it so come for the solution
If you are displaying it within a form, then just select one line number for each row in your selection statement Create There will be no difference between this
SELECT @row_number: = @ row_number + 1 as the line_number, db_names from mysql_testing, (SELECT @row_number: = 0) as db_names by command;
Comments
Post a Comment