This question is a continuation of these two:
We have a table in Big Query like below.
Input table:
Name | Question | Answer
-----+-----------+-------
Bob | Interest | ["a"]
Sue | Interest | ["a", "b"]
Joe | Interest | ["b"]
Joe | Gender | Male
Bob | Gender | Female
Sue | DOB | 2020-10-17
Bob | Others | { "country" : "es", "language" : "ca"}
Note: All the values in the Answer column are stringified values and the Arrays / JSON objects are dynamic.
We want to convert the above table to the below format to make it BI/Visualisation friendly.
Desired table:
+-------------------------------------------------------------+
| Name | a | b | c | Gender | DOB | country | language |
+-------------------------------------------------------------+
| Bob | 1 | 0 | 0 | Female | 2020-10-17 | es | ca |
| Sue | 1 | 1 | 0 | - | - | - | - |
| Joe | 0 | 1 | 0 | Male | - | - | - |
+-------------------------------------------------------------+
