search

Home  >  Q&A  >  body text

javascript - How to avoid duplication with data in the library when inserting data in mysql?

How to avoid duplication of already inserted data when inserting data into a mysql database table? What should I do? Please advise, thank you!

给我你的怀抱给我你的怀抱2798 days ago751

reply all(3)I'll reply

  • 漂亮男人

    漂亮男人2017-05-24 11:35:09

    Create unique index

    Single key index:
    create unique index UNIQUE_PERSON_NICK_NAME_INDEX ON Person (NickName) create unique index UNIQUE_PERSON_NICK_NAME_INDEX ON Person (NickName)
    双键索引:
    create unique index UNIQUE_PERSON_FULL_NAME_INDEX ON Person (LastName, FirstName)Double key index:

    create unique index UNIQUE_PERSON_FULL_NAME_INDEX ON Person (LastName, FirstName)


    MYSQL complete index creation syntax:

    MYSQL5.7 CREATE INDEX Syntax🎜

    reply
    0
  • 黄舟

    黄舟2017-05-24 11:35:09

    When you say repetition, do you mean one field is repeated or all fields are repeated?

    reply
    0
  • 迷茫

    迷茫2017-05-24 11:35:09

    Some usage summary of insert ignore into, replace into, etc. in MySQL

    reply
    0
  • Cancelreply