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

Example verification MySQL | update field with the same value will record binlog

1. Introduction A few days ago, a development col...

A must-read career plan for web design practitioners

Original article, please indicate the author and ...

Sharing tips on using Frameset to center the widescreen

Copy code The code is as follows: <frameset co...

What does the "a" in rgba mean? CSS RGBA Color Guide

RGBA is a CSS color that can set color value and ...

Using js to implement a number guessing game

Last week, the teacher gave me a small homework, ...

Detailed explanation of primary keys and transactions in MySQL

Table of contents 1. Comments on MySQL primary ke...

jQuery implements nested tab function

This article example shares the specific code of ...

Vue improves page response speed through lazy loading

Table of contents Overview What is lazy loading? ...

Using JS to implement a small game of aircraft war

This article example shares the specific code of ...

Implementation of communication between Vue and Flask

Install axios and implement communication Here we...

Solve the problem of docker's tls (ssl) certificate expiration

Problem phenomenon: [root@localhost ~]# docker im...

Do you know how to optimize loading web fonts?

Just as the title! The commonly used font-family l...