'How to join Tables as they are pivoted and its a survey data?

I have two tables. Table 1 data table:

Table 1

And table 2 ref_table

Table 2

I want to join these two tables and I want to add key column in it accordingly.

sql


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source