+ 1
Friends I unable to understand the following sql code.will please explain each and every term in this.
This is the code: SET @num := 0; UPDATE your_table SET id = @num := (@num+1); ALTER TABLE tableNameAUTO_INCREMENT = 1;
1 Resposta
0
I don't understand the last line, it's been a bit since I did anything with sql. But I'll give the rest a shot.
SET does what it says. It sets var to the next statement.
@num is a variable that I believe is the location of the cell we are editing.
After that you update the table you are working in such that the id (or name) at the cell is one more than the cell value.