I have a table with 381 records with the columns id,name,dept_id.
How would I introduce a column called row_id with numbers that count from 1-381 (to uniquely identify each row and they need to auto-increment from this point afterwards).
I would need to write this in MySQL. The only other way I can think of is manually entering this but it would take too long.
add a new column
alter table table_name add column row_id int()then execute this commandSELECT @i:=0;UPDATE table_name SET row_id = @i:=@i+1then make it primary key and set it as auto increment