I just need help with this mySQL question.
"Our products supplied at a higher price and it has been decided to pass this cost on to our customers. Increase the price by 3% on all products.
Write a query that returns a list of all products, their original price, and an additional column that contains the new (increased) prices."
Now i know how to increase the price by 3% however how am i supposed to do the second part?
尝试这个
SELECT Product, Price, Price * 1.03 as newprice From Tablename;
SELECT product_name, product_price, product_price * 1.03 as product_increased_price From products;
在上面的查询中,它实际执行的操作是通过将产品的旧价格乘以3%来获得产品的名称 (product_name)
, 产品的旧价格 (product_price)
和产品的新价格 (product_increased_price)
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.