coolair
V2EX  ›  问与答

使用 UNIQUE 在插入重复数据的时候,如果有主键自增 id,id 会跳过,怎么可以使得 id 自增不跳过?

  •  
  •   coolair · Aug 27, 2014 · 2953 views
    This topic created in 4476 days ago, the information mentioned may be changed or developed.
    比如,现在id为10,当插入一条数据的时候,如果数据重复,则跳过,再插入下一条非重复数据的时候,id变成12了,11跳过了。
    数据库为:MySQL
    4 replies  •  2014-08-27 19:04:52 +08:00
    Narcissu5
    Narcissu5
    Aug 27, 2014
    1
    哪种数据库?oracle和mysql都有sequence
    coolair
    coolair
    OP
    Aug 27, 2014
    2
    @Narcissu5 mysql
    andybest
    andybest
    Aug 27, 2014❤️1
    3
    ALTER TABLE tablename ENGINE=MYISAM;
    coolair
    coolair
    OP
    Aug 27, 2014
    4
    @andybest 非常感谢!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   889 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 20:37 · PVG 04:37 · LAX 12:37 · JFK 15:37
    ♥ Do have faith in what you're doing.