Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
插入值时如何避免在 SQLite 中添加重复条目?
现在当我插入时,它正在添加重复项。
您需要在表的某处添加一个唯一索引,以便将行插入:
create unique index mytable_id on mytable (id)
现在,如果您尝试将具有相同 id 的两行添加到 mytable,sqlite 将引发错误。