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

About deploying a web project to Alibaba Cloud Server (5 steps to do it)

1. First log in to the Alibaba Cloud website to r...

Causes and solutions to the garbled character set problem in MySQL database

Preface Sometimes when we view database data, we ...

MySQL 5.6.23 Installation and Configuration Environment Variables Tutorial

This article shares the installation and configur...

Generate OpenSSL certificates in Linux environment

1. Environment: CentOS7, Openssl1.1.1k. 2. Concep...

The most common mistakes in HTML tag writing

We better start paying attention, because HTML Po...

Using vue3 to imitate the side message prompt effect of Apple system

Table of contents Animation Preview Other UI Libr...

HTML table tag tutorial (46): table footer tag

The <tfoot> tag is used to define the style...

Docker connects to a container through a port

Docker container connection 1. Network port mappi...

Web Design Summary

<br />From the birth of my first personal pa...

mySql SQL query operation on statistical quantity

I won't say much nonsense, let's just loo...

How to use the debouce anti-shake function in Vue

Table of contents 1. Anti-shake function 2. Use d...