How to prevent to insert duplicate value in sqlite database (if duplicate then overwrite)

前端 未结 6 1260
余生分开走
余生分开走 2021-01-05 15:34

I had created two table in my database, In both table I am inserting value at the same time, now what I want to do is that, I want to insert record in second table, but the

6条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-05 16:31

    Check with the primary key of which you want assign then while inserting check with on duplicate key.. if you want you update the row

    on duplicate key update

    As mentioned i am writing the code on duplicate key

    INSERT OR REPLACE INTO TABLE_CATEGER(value1,value2,value3)
    

提交回复
热议问题