Another form of UPDATE?

2

I am doing a Mysql class work and I would like to know another way of UPDATE because it is not changing.

  

Update the price of the service of all the animals that received bath in the pet shop and had value less than 15 reais.

UPDATE 'aula_sub_query'.'servico_prestado' 
    SET 'preco' = 25.00
    WHERE 'cod_SERVICO_PRESTADO' = 1 AND 'preco' < 25.00;
asked by anonymous 09.07.2017 / 04:44

1 answer

5

Andrews, assuming the service code for Bath in PET SHOP is 1, as you are using in WHERE, you just need to fix the value of your condition.

Instead of using

UPDATE aula_sub_query.servico_prestado SET preco = 25.00
WHERE cod_SERVICO_PRESTADO = 1 AND preco < 25.00;

Use

UPDATE aula_sub_query.servico_prestado SET preco = 25.00
WHERE cod_SERVICO_PRESTADO = 1 AND preco < 15;
    
09.07.2017 / 05:02