开发者

select and then insert in sqlite table

开发者 https://www.devze.com 2023-02-18 23:16 出处:网络
I am trying to insert records into a sqlite table where in I have to first run a select query on the table and if the record does not exists then insert it.

I am trying to insert records into a sqlite table where in I have to first run a select query on the table and if the record does not exists then insert it.

Is there an ef开发者_Python百科ficient way of doing this?


Looks like INSERT OR REPLACE would suit you here aka REPLACE in MySQL.

See:

http://www.sqlite.org/lang_replace.html

http://dev.mysql.com/doc/refman/5.0/en/replace.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号