示例一:插入多条记录
假设有一个主键为 client_id 的 clients 表,可以使用下面的语句:
INSERTINTOclients(client_id, client_name, client_type)SELECTsupplier_id, supplier_name, 'advertising'FROMsuppliersWHEREnotexists(select * fromclientswhereclients.client_id = suppliers.supplier_id);
示例一:插入单条记录
INSERTINTOclients(client_id, client_name, client_type)SELECT10345, 'IBM', 'advertising'FROMdualWHEREnotexists(select * fromclientswhereclients.client_id = 10345);