Hello to all!
There was a task - to optimize the structure of the MySQL database, highlighting some fields in separate tables.
The database contains data on products, their categories and several additional fields. properties.
Everything is contained in one huge table of VARCHAR fields (mostly).
It is necessary to find unique VARCHAR lines for different fields and select them into separate tables, leaving only the key in the main one.
Is it possible to do this using only MySQL?
If not, then tell me at least the general algorithm - I'm very afraid to spoil the data in this database myself.
1. - The structure of the existing database - only necessary in this case the field.
MAIN TABLE
`id` int(10) unsigned NOT NULL AUTO_INCREMENT - (ΡΠ½ΠΈΠΊΠ°Π»ΡΠ½ΡΠΉ ΠΠ ΠΏΠΎΠ·ΠΈΡΠΈΠΈ ΡΠΎΠ²Π°ΡΠ°) `prod_name` varchar(255) NOT NULL - Π½Π°Π·Π²Π°Π½ΠΈΠ΅ ΠΏΠΎΠ·ΠΈΡΠΈΠΈ(Π½Π΅ΡΠ½ΠΈΠΊΠ°Π»ΡΠ½ΠΎΠ΅) `prod_cat` varchar(64) NOT NULL - Π½Π°Π·Π²Π°Π½ΠΈΠ΅ ΠΊΠ°ΡΠ΅Π³ΠΎΡΠΈΠΈ(Π½Π΅ΡΠ½ΠΈΠΊΠ°Π»ΡΠ½ΠΎΠ΅) `prod_prop01` varchar(64) NOT NULL - Π½Π°Π·Π²Π°Π½ΠΈΠ΅ ΡΠ²ΠΎΠΉΡΡΠ²Π°1(Π½Π΅ΡΠ½ΠΈΠΊΠ°Π»ΡΠ½ΠΎΠ΅) `prod_prop02` varchar(64) NOT NULL - Π½Π°Π·Π²Π°Π½ΠΈΠ΅ ΡΠ²ΠΎΠΉΡΡΠ²Π°2(Π½Π΅ΡΠ½ΠΈΠΊΠ°Π»ΡΠ½ΠΎΠ΅) 2. - I would like to get a trail. structure
MAIN TABLE
`id` int(10) unsigned NOT NULL AUTO_INCREMENT - (ΡΠ½ΠΈΠΊΠ°Π»ΡΠ½ΡΠΉ ΠΠ ΠΏΠΎΠ·ΠΈΡΠΈΠΈ ΡΠΎΠ²Π°ΡΠ°) `prod_name` int(10) - ΠΠ Π½Π°Π·Π²Π°Π½ΠΈΡ ΠΏΠΎΠ·ΠΈΡΠΈΠΈ(ΡΠ½ΠΈΠΊΠ°Π»ΡΠ½ΡΠΉ) `prod_cat` int(10) - ΠΠ ΠΊΠ°ΡΠ΅Π³ΠΎΡΠΈΠΈ(ΡΠ½ΠΈΠΊΠ°Π»ΡΠ½ΡΠΉ) `prod_prop01` int(10) - ΠΠ ΡΠ²ΠΎΠΉΡΡΠ²Π°1(ΡΠ½ΠΈΠΊΠ°Π»ΡΠ½ΡΠΉ) `prod_prop02` int(10) - ΠΠ ΡΠ²ΠΎΠΉΡΡΠ²Π°2(ΡΠ½ΠΈΠΊΠ°Π»ΡΠ½ΡΠΉ) TABLE OF NAMES
`id` int(10) unsigned NOT NULL AUTO_INCREMENT - (ΡΠ½ΠΈΠΊΠ°Π»ΡΠ½ΡΠΉ ΠΠ ΠΠ°Π·Π²Π°Π½ΠΈΡ) `name` varchar(64) NOT NULL - Π½Π°Π·Π²Π°Π½ΠΈΠ΅ ΠΏΠΎΠ·ΠΈΡΠΈΠΈ(ΡΠ½ΠΈΠΊΠ°Π»ΡΠ½ΠΎΠ΅!) And the same tables for - categories, properties1 and properties2.
I am sure that the task is pretty banal - DB decomposition.
But I'm not special. I have not yet managed to finish reading the chapters on this, and I have a rather superficial understanding of the methods of decomposition.
I will be glad to any practical advice. Thank.