3

How do i increase the values in a column with percentage increment using MySQL, for example:

ID      price
1       500
2       800
3       450

How do i increase the values in price column by 20% using one sql query (MySQL)?

4

Simply calculate 20% of actual price:

update your_table
set price = price + (price * 20.0 / 100.0)
where id = (some condition)

or a shorter way:

update your_table
set price = price * 1.2
where id = (some condition)
| improve this answer | |
  • Even shorter - price = price*1.2 – Kondybas Apr 27 '17 at 8:01
2
UPDATE table_name SET column_name=column_name*(100+percentage)/100
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.