MySQL Forums
Forum List  »  Newbie

Re: Help using MySQL reformatting data
Posted by: Zach Ellis
Date: October 02, 2023 12:52PM

Hello Nirgal

I'm new to mysql dba so if someone more experienced comes go with them.

you can create another table that has a unique id for the product and just reference it as a foreign key.


new product table

product_id, product_name, product_sku


the product column would be a foreign key of the product_id

State - city - convenient store - product = foreign key of product_id

i guess one way to speed up the reformatting would be after you create the new product table create a csv file that matches the table structure and load it into the empty table same thing for the revised old table.

you can drop the columns with all the skus numbers leaving the state, city, convenient store columns then export those three columns that still have the data as a csv then when you have the product table done add in the foreign key column from the product table into the csv as the fourth column then load it back into the revised table.

make sure you take a backup of the table before doing all this

hope this helps
Zach Ellis

Options: ReplyQuote


Subject
Written By
Posted
Re: Help using MySQL reformatting data
October 02, 2023 12:52PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.