表名是Products,我想对Products表中每个价格超过10美元的条目的价格应用50%的折扣。
https://www.w3schools.com/sql/trysql.asp?filename=trysql_select_all
答案 0 :(得分:1)
这应该这样做
Update products set price = price/2 where price >10;
答案 1 :(得分:0)
SELECT ProductId,
ProductName,
SupplierID,
CategoryID,
Unit,
CASE WHEN Price > 10 THEN PRICE * 0.5
ELSE PRICE
END AS PRICE
FROM Products;