Previous Section  < Day Day Up >  Next Section

Chapter 9. Importing and Exporting Data

This chapter covers the following exam topics:

Questions on the material in this chapter make up approximately 5% of the exam.

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.

  • SELECT … INTO OUTFILE writes the result of a SELECT statement to a file.

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

The mysqlimport client provides another way to load datafiles into tables. It's a command-line interface to the LOAD DATA INFILE statement. It examines its arguments to determine what you want it to do, and then constructs appropriate LOAD DATA INFILE statements and executes them on your behalf. For more information about this program, see section 3.3, "Using mysqlimport."

    Previous Section  < Day Day Up >  Next Section