I have an existing table with the following structure
+-------------+-------+-------+-------+
| employee_id | val_1 | val_2 | val_3 | ...
+-------------+-------+-------+-------+
| 123 | A | B | C |
I want to change this single table into 2 tables - one which contains the values in seperate rows, and another with becomes a join table for this. For example, the above would be turned into this:
+-------------+--------+ +----+-------+
| employee_id | val_id | | id | value |
+-------------+--------+ +----+-------+
| 123 | 1 | | 1 | A |
+-------------+--------+ +----+-------+
| 123 | 2 | | 2 | B |
+-------------+--------+ +----+-------+
| 123 | 3 | | 3 | C |
+-------------+--------+ +----+-------+
What's the best SQL to use to convert the existing table into these 2 new tables? I can create the values table easy enough, but I'm not sure how to create the join table at the same times.