vs mdk vs mdk - 2 months ago 9
MySQL Question

Mysql table with more than one Auto-Incremented column

I have a table with the following structure:

id | number | text
----------------------
1 | 1 | test


in which, id is my primary key with auto increment value. I want to make number as auto increment value too. Is it possible to have more than one auto increment column in one table?

Answer

It is not possible.There can be only one auto-increment column and it must be defined as a key in MySQL. But You can do it by using trigger for detail go this link CREATE TRIGGER

Comments