1. The query statement is select * from t_table; The exported data format is as follows:
2. Back up the data text, then open it using notepad++, then copy the data to the new TXT and replace it as follows:
1) will "| "Delimiter (delimiter of different fields), replace with ', ' is the delimiter of the different fields in the SQL statement;
2) Leave the leftmost "|" For each row of data "Replace with (') the left parenthesis of each record in the SQL statement;
3) the "|" at the far right of each row of data Replace with '), which is the right parenthesis for each record in the SQL statement;
4) Replace the last row of data with the end of the symbol for the SQL statement;
5) Replace "", no space required;
6) The first line of data is preceded by insert into t_table values, and the data is concatenated together to form the SQL statement.
3. Execute the assembled SQL and modify them if there are any errors.
The assembled SQL statement format is as follows:
Note that each field is treated as a string, and if a field cannot be treated as a string, it needs to be modified accordingly.
But in any case, this one-time insertion, it is more convenient, and high insertion efficiency.
MySQL database using SQL command Window query data, changed to SQL statement imported into MySQL database