📜  sqlite 如果不存在则插入 - SQL 代码示例

📅  最后修改于: 2022-03-11 15:04:52.842000             🧑  作者: Mango

代码示例1
#id column is assumed to be primary key

INSERT INTO destination_table(id,name) 
SELECT id, name
FROM source_table s
WHERE NOT EXISTS (
  SELECT 1
  FROM destination_table d
  WHERE d.id = s.id
);