Click on “Road of Technology for Migrant workers” and choose “Top or Star label”
10 o ‘clock every day for you to share different dry goods
Source: ju. Outofmemory. Cn/entry / 336774
Several times recently, some developers asked me on Dingding, such as the picture below:
Update a record in MySQL, the syntax is correct, but the record is not updated…
When I first encountered this problem, I took this statement and directly executed it in the test library. I found that there was a problem, but there was still a difference with the development description. Here I use the test data to simulate:
SQL statement with problem:
The record before execution looks like this:
The record after execution looks like this:
As you can see, the result is not “as if it didn’t work”, but actually it does:
why?
MySQL > update MySQL > update MySQL > update MySQL
The format of assignment_list is a comma-separated list of col_name=value.
Go back and try again:
Sure enough, I got the result I wanted!
Summary: If you want to UPDATE multiple fields in an UPDATE statement, do not use “AND” between the fields. Instead, separate the fields with commas.
Owner_code =0; owner_code=0; After many attempts:
Is equivalent to:
(‘43212′ and owner_name=’ li si ‘) is a logical expression, and it is not obvious that owner_name is not ‘Li Si’.
Therefore, the result of this logical expression is false, which in MySQL is equivalent to 0!
Pay attention to the wechat public number of the road of technology of migrant workers, in the background reply keyword: 1024 or 2048, you can get a latest arrangement of technical dry goods.
Public account back to “road to God” to get all the content
– MORE excellent articles – |
-
What a painful realization: 13 painful outages
-
“China’s top Ten Universities” competition!
-
The evolution of ten-million-level high concurrency architecture of Taobao server
-
College entrance examination results burst, Jack Ma had taken an examination of 1 points, Li Yanhong east brother is excellent students..
-
Programmers are rewarded for writing bugs, but operation and maintenance are not! ?
Long press the TWO-DIMENSIONAL code to pay attention to the technical road of migrant workers
Public number background reply “catalog” can view the public number article catalog, reply “add group” can join the reader technical exchange group, communicate with you together.
——————————-
Thank you for reading, below is a lucky draw link, click the link to enter the lucky draw, June 30, 2019 23:59, thank you for your support!
Thank you for reading, watching and forwarding all the time, click on me to participate in the lucky draw! Click on me to enter the draw!
All the best of the official account is here
You are watching, click here to have a surprise oh ~