CODE CODIFY.CLUB

ADD Unique/Primary ID Auto Increment at First position in MySQL

ALTER TABLE content ADD file_id INT UNSIGNED NOT NULL AUTO_INCREMENT FIRST,
ADD PRIMARY KEY (file_id);

Note : When table do not have primary key
1) FIRST ( Its means add at 1st position )
2) Table name : content
3) New Field name : file_id

————————————————————————————————————

ALTER TABLE <TABLE NAME> ADD <FIELD NAME> INT UNSIGNED NOT NULL AUTO_INCREMENT FIRST,
ADD PRIMARY KEY (<FIELD NAME>);

————————————————————————————————————

V!ral

Developer, Technology aficionado, Beer Lover and founder of codify.club Network. Who shares a keen interest about website development, health issues, cancer awareness and other fun stuff.

Add comment

Follow us

Don't be shy, get in touch. We love meeting interesting people and making new friends.

Most popular

Most discussed