Way 1:insert into T1 (field1,field2) VALUE (' 001 ', ' 002 ');
The best practice is to explicitly insert each column, listed in the error, and the chance of missing the column will be reduced!
Way 2:insert into T1 (field1,field2) VALUES (' 001 ', ' 002 '), (' 003 ', ' 004 ') ...;
It is best to bulk insert data in bulk, but when the data is too large, it is best to BULK insert in batches!
Way 3:insert into T2 (field1,field2) SELECT col1,col2 from T1 WHERE ...;
To put it simply, it may be more flexible to use because you can specify columns to insert into talbe2, and data sources can be obtained through relatively complex query statements, but we must also note that when we specify columns for the target table, we must fill in all non-empty columns. Otherwise, you won't be able to insert the data, and there's a little bit more error-prone when we write the variant shorthand format for the following 3:
Variant of Mode 3: INSERT into T2 SELECT ID, name, address from T1
At this point, if we omit the column of the target table, then the data is inserted by default on all columns of the target table, and the order of the columns after the select must be exactly the same as the columns in the target table in order to complete the correct data insertion, which is a very easy to ignore place, worth noting.
SQL statement INSERT INTO statement