A sql query yields data that looks like this:
| name | quality | magnitude |
|---|---|---|
| john | kindness | 7 |
| john | greed | 2 |
| jane | kindess | 3 |
| jane | greed | 7 |
| john | temper | 9 |
| jane | temper | 4 |
I am wondering if there is a way to transform it into data that looks like this using SQL:
| name | personality |
|---|---|
| john | kindess:7, greed:2, temper:9 |
| jane | kindess: 3, greed: 7, temper: 4 |
If yes:
- How do it do it?
- Is this an optimal/good idea?
I am on Postgres 9+