Let's say I have this table A with 300k rows
+---------+---------+---------+--------+--------
| id | Col1 | Col2 | Col 3 | Col n..
+---------+---------+---------+--------+--------
| id val | Value 1 | Value 2 | Val 3 | n..
+---------+---------+---------+--------+--------
I want to create a denormalized table B that would look like
+---------+---------+---------+
|tab_a_id | Key | Val |
+---------+---------+---------+
| id val | Col 1 | Value 1 |
+---------+---------+---------+
| id val | Col 2 | Value 2 |
+---------+---------+---------+
| id val | Col 3 | Val 3 |
+---------+---------+---------+
| id val | Col n.. | n.. |
Is there a way to dynamically run over the columns of table A to insert it into table B with the id from Table A, the column name as Key and the Value of each column?