This article is mysql database Question 1 Import the data from Table 1 into Table 2: Import the data from Table 1 into Table 2: Insert the data in Table 2 into Table 1. The columns in Table 1 correspond to the columns selected in Table 2. INSERT INTO table1 (column1, column2, column3, column4) select column1, column2, column3, column4 from table 2 When inserting data into the table in question 2, a field takes the maximum value of the field in the database and adds 1. When inserting data into a table, a field takes the maximum value of the field in the database and adds 1. Many people say that this problem can be solved by using stored procedures or something. In fact, the combination of insert and select can solve this problem very well. Example: When inserting a new record into table 1, the age value is the maximum value in the database and added 1, and is stored in the database as the age of the new data. (Of course, the select statement for age can also add a where condition.) INSERT INTO table1( column1, column2, column3, column4, age )SELECT column1, column2, column3, column4, (select IFNULL((select max(age) from table name,0)+1); Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. If you want to learn more about this, please check out the following links You may also be interested in:
|
<<: Docker deployment springboot project example analysis
>>: How to use webSocket to update real-time weather in Vue
Selector Grouping Suppose you want both the h2 el...
Preface Previously, I talked about the problem of...
Table of contents 1. Array flattening (also known...
1. Rendering 2. Source code HTML < body > &...
In this post, we’ll use the :placeholder-shown ps...
Purchase Certificate You can purchase it from Ali...
The following questions are all based on the Inno...
<br />Adding pictures reasonably can make a ...
As the data stored in the MySQL database graduall...
This article shares the specific code of JavaScri...
Table of contents 1. Repeated declaration 1.1 var...
The project test environment database data is los...
Table of contents Written in front 1. Ngixn image...
Unable to load dynamic library under Linux When t...
MySQL 5.7.13 installation tutorial for Mac, very ...