Tuesday, 15 January 2013

mysql - Introducing a column of numbers that count from 1-381 -



mysql - Introducing a column of numbers that count from 1-381 -

i have table 381 records columns id,name,dept_id.

how introduce column called row_id numbers count 1-381 (to uniquely identify each row , need auto-increment point afterwards).

i need write in mysql. other way can think of manually entering take long.

add new column alter table table_name add together column row_id int() execute command select @i:=0;update table_name set row_id = @i:=@i+1then create primary key , set auto increment

mysql phpmyadmin

No comments:

Post a Comment