Import Excel data to MySQL

Source: Internet
Author: User

1. Copy the selected data to a txt text file (remember to remove the trailing space). ), if it is stored in the "D:\data.txt" position.

2. Build the MySQL database and table based on the data you want to import, and then go to the command prompt using the command

Load data local infile ' D:\data.txt ' into table exceltomysql fields terminated by ' \ t ';

To import an operation

Specific or reference to master:

Http://hi.baidu.com/harite/blog/item/6a5fb9de55e6f258ccbf1adf.html

Thank you very much, I also make a note

Manual Excel data and MySQL data conversion

September 16, 2006 Saturday 02:44

 

    today is the national Mathematical Modeling competition, students choose a topic need to a large Excel table statistics, Good friend ~ ~ helped him to complete the conversion of data from Excel to MySQL. Write down the specific steps to share to everyone, also lest everyone to the Internet everywhere search.

    If you want to import the Excel table into the MySQL database,

,

 

Step one:

Select the data you want to import quickly, and another column, such as:

Step two:

Copy the selected data to a new table workbook, and then save as-text file (tab split) (*.txt), if it is in the "D:\data.txt" position.

 

Step three:

Build the MySQL database and table based on the data you want to import, and then use the command

Load data local infile ' D:\data.txt ' into Table Exceltomysql fields terminated by ' \ t ';

The

carries out the import operation. For example:

Now the data has all been imported into MySQL,

Let's select a bit,

Here, the data from Excel to MySQL conversion has been completed.

Next, the data from MySQL to Excel conversion, the process is actually the use of the "tab split" text file.

will be able to import the male information from this table into Excel.

Select * into outfile ' D:\man.txt ' from exceltomysql where xingbie= "male";

This way, the information for all the boys in the table is exported to a text file in the D:\man.txt file that ends with a tab segment, ' \ n '.

You can open Excel and choose Import data, import external data, and select D:\man.txt to make sure it's all right.

Related Article

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.