MySQL Forums
Forum List  »  Newbie

Re: Maybe There is a Problem about auto_increment_increment
Posted by: Peter Brawley
Date: February 18, 2021 10:20AM

> create table test(id int not null primary key auto_increment unique)

Primary keys are by definition unique. Lose the redundant "unique" from that cmd.

Auto_increment guarantees uniqueness, not exact sequentiality. If you want the latter, follow the standard practice of preparing a table of desired values, use it to pluck keys when needed.

Options: ReplyQuote


Subject
Written By
Posted
Re: Maybe There is a Problem about auto_increment_increment
February 18, 2021 10:20AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.