问题
After increasing the rental fee of each large slip by $150 (Exercise 3), Alexamara decides to decrease the rental fee of any slip whose fee is more than $4,000 by one percent. Update the rental fees in the LARGE_SLIP table accordingly.
我有一个有效的命令,但我不知道这本书是否想让我这么做:
update LARGE_SLIP set RENTAL_FEE = RENTAL_FEE - 42 where RENTAL_FEE = '4200';
这是因为表中只有两项纪录,租金超过4 000元,而两者的租金都是4200元。我想知道我是否可以使用命令,对4000以上的任何费用适用1%的租金折扣,例如:
update LARGE_SLIP set RENTAL_FEE = RENTAL_FEE - 1% where RENTAL_FEE > '4000';
我不知道如何使这类命令正常工作,或者是否存在这样的命令。
发布于 2014-11-10 04:19:32
update LARGE_SLIP set RENTAL_FEE = RENTAL_FEE*0.99 where RENTAL_FEE > 4000;
或
update LARGE_SLIP set RENTAL_FEE = RENTAL_FEE-RENTAL_FEE*0.01 where RENTAL_FEE > 4000;
我在4000中删除了引号,因为你不太可能在数字的条件语句中加上一个字符。
https://stackoverflow.com/questions/26836661
复制相似问题