Mysql - perform an update via db with "set price = price - 5%" [duplicate]

-1

How do I do an update where the price of the product will decrease by percentage?

  

Example:

     

Table:

     

id | products

     

10 | 1.40

How do I make an update that returns the value 1.40 - 5%?

    
asked by anonymous 24.10.2018 / 15:15

1 answer

2

Five percent = 5 / 100

therefore:

preco = preco - ( preco * 5 / 100 )
    
24.10.2018 / 15:19