我在练习中被要求从两列 List_price 和 discount_amount 中计算三个值。我的部分问题是我的编程本能想要阻碍我完全掌握所教内容的能力。
有人可以告诉我代码有什么问题并提供一个模板来更好地处理这种情况。
SELECT list_price, discount_percent, product_name, raw_percent,
discount_amount, (list_price - discount_amount) AS discount_price
FROM (
SELECT discount_percent,
list_price,
(discount_percent /10) = raw_percent
(list_price * raw_percent) = discount_amount
) ORDER BY discount_price DESC LIMIT 5;