Auto increment alter mysql example

(Last Updated On: August 11, 2016)

Auto increment:

If any of your primary field need to be auto incremented. You can alter the column like below or you can create the sequences also for the same.

ALTER TABLE search modify COLUMN id INT NOT NULL AUTO_INCREMENT;

Here search is the table name.
id is the column name.

While inserting you can put null or 0 for id(auto increment) column.

259 total views, 0 views today

Leave a Reply

Your email address will not be published. Required fields are marked *