15.1. Import and Export Operations


MySQL includes two SQL statements that can be used to import data from files into your database or export data from your database into files:

  • LOAD DATA INFILE reads data records directly from a file and inserts them into a table.

  • SELECTINTO OUTFILE writes the result of a SELECT operation to a file.

The two statements are related in the sense that they both transfer information between MySQL and data files. Also, both statements use similar syntax for describing the format of data file contents.

Data file import and export also can be performed from the command line. This is done using the mysqlimport and mysqldump client programs. For bulk data transfer operations, these programs act as command-line interfaces to the LOAD DATA INFILE and SELECTINTO OUTFILE statements. Each program examines its arguments to determine what you want it to do, and then constructs appropriate SQL statements and sends them to the MySQL server on your behalf.



MySQL 5 Certification Study Guide
MySQL 5.0 Certification Study Guide
ISBN: 0672328127
EAN: 2147483647
Year: 2006
Pages: 312

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net