'Increase products price by 10%
I am having problems increasing the prices of my hp products by 10%.
Here is what I've tried -->>
UPDATE products SET price = price*1.1;
from products
where prod_name like 'HP%'
Here is a picture of the products table:

Solution 1:[1]
This is an UPDATE, not a SELECT, so the FROM clause is incorrect. Also, the semicolon should go at the end of the last line.
UPDATE products SET price = price*1.1; <== Remove the semicolon
from products <== remove this line
where prod_name like 'HP%' <== add a semicolon at the end of this line
Try this instead:
UPDATE products SET price = price*1.1
where prod_name like 'HP%';
Solution 2:[2]
Correct query would be like this:
update products set price = price * 1.1
where prod_name like 'HP%' ;
Don't know why you have highlighted Toshiba ? Do you want this to update ?
Solution 3:[3]
UPDATE Products
SET price = price+ price*0.1
WHERE prod_name LIKE 'HP%' ;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | TarasB |
| Solution 3 | Chris Catignani |
