By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
| @sql |
|---|
| SELECT respondent_id , a.question , a.answer FROM source_table a WHERE a.demographic IS NULL GROUP BY respondent_id, a.question , a.answer |
| respondent_id | question | answer |
|---|---|---|
| 1 | Age | 30 |
| 1 | education | masters |
| 1 | height | 1.8m |
| 1 | income | $1 |
| 1 | address | ISS |
| 1 | talent | dancing |
| 2 | Age | 20 |
| 2 | education | highschool |
| 2 | height | 4m |
| 2 | income | $3.2 |
| 2 | address | Highsea |
| 2 | talent | singing |