Method 1: 1. in the last column of the data to be imported, write an Excel Formula (in this example, it is the cell under "SQL", "SQL" is not necessary, just for convenience ). = CONCATENATE ("insert into employee (name, birthday, email, Hober) values ('", RC [-4], "', '", RC [-3], "','", RC [-2], "','", RC [-1], "');") ") the insert statement is generated, as you can see in the Excel file in the example (when you click the cell below SQL, you can see the formula ). If there is a date format, use the following aspect = CONCATENATE ("insert into employee (name, birthday, email, holobby) values ('", RC [-4], "', '", TEXT (RC [-3]," yyyy-mm-dd hh: mm: ss "),"', '", RC [-2],"', '", RC [-1],"'); ") here, the TEXT function is used to format the date into a date string that mysql can accept. method 2. If you want to import an Excel table to the MySql database, Step 1: select the data to be imported and add one more column, for example:
Step 2: copy the selected data to a new table, and then "Save as"-"text file (Tab segmentation )(*. txt) ", if saved to the location" D: \ data.txt.
Step 3: Create a MySql database and table based on the data to be imported, and then run the command load data local infile 'd: \ data.txt 'into table exceltomysql fields terminated by '\ T '; import. For example:
Now all the data has been imported into MySql. Let's select it,
By now, the data has been converted from Excel to MySql. Next, the process of converting data from MySql to Excel is actually a text file separated by a tab. If you want to import the boy information in this table to Excel, you can. Select * into outfile 'd: \ man.txt 'from exceltomysql where xingbie = "male"; in this way, all boys' information in the table is output to be separated by tabs, '\ n' in the text file D: \ man.txt. You can open the Excel file, select "data"> "Import external data"> "import data", select "D: \ man.txt", and click "OK. Prepared by xyaxlz