Detailed analysis of the syntax of Mysql update to modify multiple fields and

Detailed analysis of the syntax of Mysql update to modify multiple fields and

When updating a record in MySQL, the syntax is correct, but the record is not updated...

Question Statement

The record before execution is as follows:

The record after execution is as follows:

As you can see, it actually works:

why?

It seems that there is no problem with the syntax. The update syntax of the MySQL official document is:

Seeing that the format of assignment_list is a comma-separated list of col_name=value , it suddenly became clear that the multi-field update statement that the developer wanted should be written like this:

Summary: In an UPDATE statement, if you want to update multiple fields, you cannot use "AND" between the fields, but should separate them with commas.

Principle: Why does the strange result of owner_code=0 appear when "AND" is used to separate? After many attempts, I found that:

And ('43212' and owner_name='李四') is a logical expression, and it is not difficult to know here that owner_name is not '李四'. Therefore, the result of this logical expression is false, which is equivalent to 0 in MySQL!

This is the end of this article about the syntax of mysql update to modify multiple fields and. For more relevant mysql update to modify field and syntax content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Non-standard implementation code for MySQL UPDATE statement
  • mysql update case update field value is not fixed operation
  • When modifying a record in MySQL, the update operation field = field + string
  • MySQL select results to perform update example tutorial
  • Will Update in a Mysql transaction lock the table?
  • Record a pitfall of MySQL update statement update
  • Detailed example of MySQL joint table update data
  • Detailed explanation of the execution process of mysql update statement
  • Summary of Mysql update multi-table joint update method
  • Difference between MySQL update set and and

<<:  vue front-end HbuliderEslint real-time verification automatic repair settings

>>:  Detailed analysis of each stage of nginx's http request processing

Recommend

Detailed explanation of the problem when combining CSS ellipsis and padding

Text truncation with CSS Consider the following c...

How to install the graphical interface in Linux

1. Linux installation (root user operation) 1. In...

How to modify port 3389 of Windows server 2008 R2 remote desktop

The default port number of the Windows server rem...

Several ways to backup MySql database

mysqldump tool backup Back up the entire database...

Detailed explanation of Javascript Echarts air quality map effect

We need to first combine the air quality data wit...

Multiple ways to insert SVG into HTML pages

SVG (Scalable Vector Graphics) is an image format...

Solution to high CPU usage of Tomcat process

Table of contents Case Context switching overhead...

Which loop is the fastest in JavaScript?

Knowing which for loop or iterator is right for o...

Solution to 404 Problem of Tomcat Installation in Docker

Find the containerID of tomcat and enter the toma...

An example of elegantly writing status labels in Vue background

Table of contents Preface optimization Extract va...

MySQL inspection script (must read)

As shown below: #!/usr/bin/env python3.5 import p...

JavaScript CollectGarbage Function Example

First, let's look at an example of memory rel...