Reputation: 3494
I have an SQL-File defining a table with 2 columns - product-id and product-reference. I need to import that file into an existing table that has the same structure (plus some extra columns), where product-id corresponds to the product-id from the backup file. Is there a simple way to do that via phpmyadmin?
Upvotes: 1
Views: 2037
Reputation: 1270773
One approach is to use load data infile
(see here) with the set
option to assign column values. Columns that are not being set will be given their default values, which is typically NULL
.
Personally, I would load the data into a staging table with two columns and then insert
the data from the staging table into the final table. This makes it easier to validate the data before putting it into the "real" table.
Upvotes: 2