Database Reference
In-Depth Information
Exporting a test file
Before trying an import, let's generate an
author.csv
export file from the
author
table. We use the default values in the
CSV export
options. We can then
Empty
the
author
table—we should avoid dropping this table because we still need the
table structure.
CSV
From the
author
table menu, we select
Import
and then
CSV
.
We can influence the behavior of the import in a number of ways. By default,
importing does not modify existing data (based on primary or unique keys).
However, the
Replace table data with file
option instructs phpMyAdmin to use
REPLACE
statement instead of
INSERT
statement, so that existing rows are replaced
with the imported data.
Using
Ignore duplicate rows
,
INSERT
IGNORE
statements are generated. These cause
MySQL to ignore any duplicate key problems during insertion. A duplicate key from
the import file does not replace existing data, and the procedure continues for the
next line of CSV data.
We can then specify the character that terminates each field, the character that
encloses data, and the character that escapes the enclosing character. Usually this
is
\
. For example, for a double quote enclosing character, if the data field contains
a double quote, it must be expressed as
"some data \" some other data"
.
Search WWH ::
Custom Search