Because the table must exist prior to the import, the CSV import dialog is available
only from the Import sub-page in the Table view, not in the Database view.
Importing Structure and Data
[ 144 ]
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), but
the Replace table data with file option instructs phpMyAdmin to use REPLACE
statements instead of INSERT; statement so that existing rows are replaced with the
imported data.
Chapter 8
[ 145 ]
With 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 \.
Pages:
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151