MySQL测试通过
方法1. INSERT IGNORE INTO
insert ignore into actor values ('3', 'WD', 'GUINESS', '2006-02-15 12:34:33');
方法2. on duplicate key update;MySQL适用
insert into actor(actor_id, first_name, last_name, last_update)
values ('3', 'WD', 'GUINESS', '2006-02-15 12:34:33')
on duplicate key update first_name='WD', last_name='GUINESS', last_update='2006-02-15 12:34:33';
方法3. insert时带有where条件的写法;根据条件防止重复插入: INSERT INTO IF EXISTS
insert into actor(actor_id, first_name, last_name, last_update)
select 3, 'WD', 'GUINESS', '2006-02-15 12:34:33' from DUAL
where not exists (select actor_id FROM actor WHERE actor_id = 3);