“Insert if not exists” statement in SQLite

后端 未结 4 956
借酒劲吻你
借酒劲吻你 2020-11-22 12:14

I have an SQLite database. I am trying to insert values (users_id, lessoninfo_id) in table bookmarks, only if both do not exist before

4条回答
  •  时光取名叫无心
    2020-11-22 12:48

    For a unique column, use this:

    INSERT OR REPLACE INTO table () values();
    

    For more information, see: sqlite.org/lang_insert

提交回复
热议问题