Right now I have the following tables items
-
name (varchar)
-
category (varchar)
-
id
…etc
I want to create a categories table and items_categories mapping table so i can start tracking categories in its own table.
The problem is with a large items table it takes awhile
Right now I do select distinct category on items table. That is going to be slow and there really isn't a way around it.
What is the fastest way to migrate the category field in items to have a category table and a categories items table? This has to be done in all Sql (no external scripts)
Best Answer
Caveat: This is untested code.