udpate customer set money =100 where balance >= 100
All balance >=100 money=100
Let’s talk about the wrong thing
update customer set moeny = 100 and balance >= 100
This error is serious,会把全局的money变为默认值,通常是0
The reason is: if there is no where, it is a global set. The multiple setting methods in the set are ','; if and is used, it will be considered as the setting of money, money = (100 and balance >=100), However, the value of this expression is unrecognized and becomes the default value.
So: the global money becomes the default value, which is very cheating,delete和update千万记得加where,尤其update,因为delete还有提醒.
Let’s talk about the correct way of writing first
All balance >=100 money=100
Let’s talk about the wrong thing
This error is serious,
会把全局的money变为默认值,通常是0
The reason is: if there is no where, it is a global set. The multiple setting methods in the set are ','; if and is used, it will be considered as the setting of money, money = (100 and balance >=100), However, the value of this expression is unrecognized and becomes the default value.
So: the global money becomes the default value, which is very cheating,
delete和update千万记得加where,尤其update,因为delete还有提醒
.So that’s it
update customer set moeny = 100 and balance >= 100
;=>
update customer set moeny = (100 and balance >= 100)
;That is to say, moeny is all set to 1 or 0.