MySQL queries and exports the specified data, select From,where,into outfile export, fields terminated by separate export data

Source: Internet
Author: User

Mysql-uxxx-pyyy

Use lottery;

Select COUNT (id) from mop_bet_order_history where Created_at < ' 2015-11-01 ';

Statistics mop_order_history number of data bars before 2015-11-01

COUNT (ID) Statistics Bar number


SELECT * from mop_bet_order_history where Created_at < ' 2015-11-01 ' to outfile '/data/tmp-2015-11.csv ' fields Termina Ted by ', ';

In the Mop_bet_order_history table, look for data before 2015-11-01 and export to the/data/tmp-2015-11.csv file, separating the data with ', '.


SELECT * from mop_bet_order_history where Created_at < ' 2015-11-01 ' and created_at > ' 2015-10-01 ' into outfile '/data /tmp-201510-11.csv ' fields terminated by ', ';

In the Mop_bet_order_history table, after 2015-10-01, the table before 2015-11-01 is exported to the/data/tmp-201510-11.csv file, and the data is separated by ', '.

where use and/or to specify multiple query conditions, such as SELECT * from student where sex= ' man ' and age-20;

Select Field1,field2. From Table1,table2. where Condition1 [and/or] condition2.

', ' separates tables that specify one or more queries;

and/or specify multiple query conditions at the same time;


MySQL queries and exports the specified data, select From,where,into outfile export, fields terminated by separate export data

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.