Importing Excel table data into mysql database

Source: Internet
Author: User
1. copy the data in the excel table to the txt file. (If you have any Chinese characters, note: Change the txt file to the 8th type. 2. Add the txt file to the D disk. 3. Create a database and a table. (Note: the attribute in the database must be consistent with the number of columns in the excel table. 4. Execute the following code on mysql: LOADDATALOCALINFILED: cccccccc.txt I

1. copy the data in the excel table to the txt file (if there are Chinese characters, note: Change the txt file to UTF-8). 2. Add the. txt file to the D disk. 3. Create a database and a table (note: the attribute in the database must be consistent with the number of columns in the excel table. 4. Execute the following code on mysql: load data local infile 'd: \ cccccccc.txt 'I

1. copy the data in the excel file to the txt file (if there are Chinese characters, note: Change the txt file to UTF-8 format)

2. Add the. txt file to drive D.

3. Create a database and a table (note: the attribute in the database must be consistent with the number of columns in the excel table)

4. Run the following code on mysql: load data local infile 'd: \ cccccc.txt 'into TABLE book fields terminated by '\ t'



1) save the file in UTF-8 format (click to encode the file =)


Supplement: We usually encounter this situation =. I don't want to import all the data in the excel table, but just import one column (that is, an attribute in mysql) run the following statement:

Load data infile 'd: \ ccccccf.txt 'ignore into table pa_db_depart (NAME, STATE, LOGO );

Note: In an excel table, if the data is arranged as follows:



When I write an SQL statement, the attribute definition sequence is the same as the data sequence in the excel table. For example, here ("China South Network" corresponds to NAME) (food.southcn.com corresponds to STATE) ("commercial media" corresponds to the LOGO) in a word, it is best not to change the order in the excel table, we just need to change the attribute order of the SQL statement.

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.