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 14 common HTTP status codes returned by the server

HTTP Status Codes The status code is composed of ...

How to install nginx under Linux

Nginx is developed in C language and is recommend...

PyTorch development environment installation tutorial under Windows

Anaconda Installation Anaconda is a software pack...

How to build a MySQL PXC cluster

Table of contents 1. Introduction to PXC 1.1 Intr...

Implementation steps for installing java environment in docker

This article is based on Linux centos8 to install...

Linux centOS installation JDK and Tomcat tutorial

First download JDK. Here we use jdk-8u181-linux-x...

How to limit the number of records in a table in MySQL

Table of contents 1. Trigger Solution 2. Partitio...

Web page HTML code explanation: ordered list and unordered list

In this section, we will learn about list element...

13 JavaScript one-liners that will make you look like an expert

Table of contents 1. Get a random Boolean value (...

VMware Workstation 15 Pro Installation Guide (for Beginners)

01. VMware Workstation Pro 15 Download Download: ...

JavaScript to implement mobile signature function

This article shares the specific code of JavaScri...

Native JS to achieve cool paging effect

This article uses an example to share with you a ...

An elegant way to handle WeChat applet authorization login

Preface When the WeChat mini program project invo...