A test question about mysql update

Source: Internet
Author: User
Tags mysql update

A mysql test question about update I went to the interview some time ago and saw a test Question: The TABLE creation statement is: CREATE table · test _ TABLE '{id int (5) unsigned NOT NULL AUTO_INCREMENT, a int (1) not null, B int (1) not null default 1) ENGINE = INNODB; then add data in the table insert into test_table SET a = 0, B = 1; insert into test_table SET a = 1, B = 2; insert into test_table SET a = 2, B = 3; insert into test_table SET a = 3, B = 4; UPDATE test_table SET a = 1 AND B = 1 is the result of the database after the following statement is executed. during development, UPDATE TABLE SET A = 1 is always used, B = 1 WHERE id = 1 and so on, I have never touched on the previous questions. Later I found through the thinking AND query manual that the column UPDATE of the UPDATE statement can be related to the expression AND then convert the statement into UPDATE test_table SET a = (1 AND B = 1) then we can analyze the four inserted statements. The first one is a = 0 B = 1. The expression analysis condition is true, and the second, third, and fourth condition expressions are false. the result is idab111202303404.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.