Okay, so I have a MySQL table called entries which contains the columns name VARCHAR(255) NOT NULL and address VARCHAR(255)
The table has about a million sets of data.
For every set of data, name has a value e.g. "john" whilst address is NULL.
For example:
+------+---------+ | name | address | +------+---------+ | john | NULL | +------+---------+ | jake | NULL | +------+---------+ | zach | NULL | +------+---------+ I received a CSV file which contains names along with their corresponding address in the format of name:address.
Like I said, the entries table has nearly a million entries, so the csv file has about 800,000 lines.
I want to take each line in the csv, and insert the address where the name is the same which would be:
UPDATE `entries` SET `address` = <address from csv> WHERE `name` = <name from csv>; I made a Python script to open the csv file reading it line by line. For each line, it would store the name and address in separate variables. It would then execute the query above, but it was taking too long to insert the data into the columns.
Is there anyway I could do this in MySQL, if so, what is the fastest way?
Thanks.