MySQL and Excel convert each other

Source: Internet
Author: User

Original address: http://blog.sina.com.cn/s/blog_43eb83b90100h0mc.html

Today is the national mathematical modelling competition, the classmate selected a topic needs to a large Excel table to carry on the statistic, the good friend son ~ ~ then helped him to complete the data from Excel to the MySQL transformation. 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, in addition to one more column, such as:




Step Two: Copy the selected data to a new table workbook, then "Save As"-"Text File (tab split) (*.txt)", if it is stored 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 the table Exceltomysql fields terminated by ' \ t '; The import operation. Such as:

Now that the data has all been imported into MySQL, let's select a bit,


To this, 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. You can do this if you want to import the boys ' information from this table into Excel. select* to OutFile ' D:\man.txt ' from Exceltomysql wherexingbie= "male";


In this way, all the boys ' information in the table is output to the text file D:\man.txt file, which 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.

MySQL and Excel convert each other

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.