Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How MYSQL uses infile/outfile

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article is about how MYSQL uses infile/outfile. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

As the existing employer requires the use of MYSQL database, so recently also began to further research on MYSQL database, the first intervention is, of course, some normal applications:

The flexibility of outfile/infile:

Today, when we come into contact with outfile and infile under mysql, it feels very appropriate and actual use. Unlike ORACLE, any operation has to be encapsulated into its own interface to achieve and operate. MYSQL directly completes the import and export of data through a simple statement, satisfying daily flexibility and controllability.

LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name.txt' [REPLACE | IGNORE] INTO TABLE tbl_name [FIELDS [TERMINATED BY' string'] [[OPTIONALLY] ENCLOSED BY 'char'] [ESCAPED BY' char']] [LINES [STARTING BY 'string'] [TERMINATED BY' string']] [IGNORE number LINES] [(col_name_or_user_var) .)] [SET col_name = expr,...)] demo: example file: e.txt==1 21 21 23 41 23 43 4 examples: e.txt==1 21 21 23 41 23 43 4 magic Magicum > load data infile 'dburee.txt'into table test1;Query OK, 7 rows affected (0.13 sec) Records: 7 Deleted: 0 Skipped: 0 Warnings: 0mysql > load data infile 'dpiste.txt'replace into table test1;Query OK, 7 rows affected (0.06 sec) Records: 7 Deleted: 0 Skipped: 0 Warnings: 0mysql > load data infile 'dpurab' replace into table test1 FIELDS TERMINATED by', 'LINES TERMINATED by' '; Query OK, 2 rows affected (0.09 sec) Records: 2 Deleted: 0 Skipped: 0 Warnings: 0mysql > load data infile'dvie e.txt' replace into table test1 FIELDS TERMINATED by', 'LINES TERMINATED by'; 'ignore 2Query OK, 0 rows affected (0.00 sec) Records: 0 Deleted: 0 Warnings: 0outfilemysql > select * into outfile'dburet out1.txt' from test1;Query OK, 23 rows affected (0.00 sec) mysql > select * into outfile'dpurl out2.txt`FIELDS TERMINATED by', 'from test1-> Query OK, 23 rows affected (0. 00 sec) mysql > select * into outfile'ddisplay out3.txt 'FIELDS TERMINATED by', 'lines terminated by'; 'from test1->; Query OK, 23 rows affected (0.02 sec) Thank you for reading! This is the end of this article on "how MYSQL uses infile/outfile". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report