How to to create unique random integer ID for primary key for table?

后端 未结 8 2131
庸人自扰
庸人自扰 2020-12-30 08:50

I was wondering if anybody knew a good way to create a unique random integer id for a primary key for a table. I\'m using MySQL. The value has to be integer.

8条回答
  •  佛祖请我去吃肉
    2020-12-30 09:31

    AUTO_INCREMENT is going to be your best bet for this.

    Here are some examples.

    If you need to you can adjust where the increment value starts (by default it's 1).

提交回复
热议问题