初级用法
高级用法
merge into
MERGE INTO t1 D
USING (SELECT EMPLOYEE_ID, SALARY, DEPARTMENT_ID FROM EMPLOYEES WHERE DEPARTMENT_ID = 80) t2
ON D.EMPLOYEE_ID = S.EMPLOYEE_ID
WHEN MATCHED THEN UPDATE SET D.BONUS = D.BONUS + S.SALARY
WHEN NOT MATCHED THEN INSERT (D.EMPLOYEE_ID, D.BONUS) VALUES (S.EMPLOYEE_ID, S.SALARY);