close
insert into t1 (name) select 'john' from dual where not exists (select 1 from t1 where name='john' limit 1 )
解:
select 'john' from dual where not exists (select 1 from t1 where name='john' limit 1 )
select 'john' from dual 會有個欄位 john 值john
select 'john' from dual where not exists 如果select 1 from t1 where name='john' limit 1 查不到時
select 'john' from dual where not exists 這句子會成立,所以會有值
全站熱搜