insert into b select emp.id,emp.sal*case when exists(select 1 from order where order.repid=emp.id)then 1.02 else 1.01 end from emp where sal 8000)
WHEN NOT MATCHED THEN INSERT (D.employee_id, D.bonus)
VALUES (S.employee_id, S.salary*.01)
WHERE (S.salary <= 8000);
SELECT * FROM bonuses ORDER BY employee_id;
EMPLOYEE_IDBONUS
----------- ----------
153180
154175
155170
159180
160175
161170
179620
173610
165680
166640
164720
172730
167620
171740
〇〇 发表于 2016-5-11 09:14
文档原文,备用
Examples
楼主原题中还有这样的要求:
“Those who have made sales get a bonus of 1% of their salary and also a salary increase of 1%."
而我的理解,工资的增加,要修改EMPLOYEES表中相应的SALARY列才可以。如果是这样,要一条语句同时修改BONUSES表和EMPLOYEES表,不能吧?