By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE
| id | brand | type |
|---|---|---|
| 1 | Honda | Coupe |
| 1 | Jeep | SUV |
| 2 | Ford | Sedan |
| 2 | Ford | Crossover |
INSERT 0 4
| id | discrepancy |
|---|---|
| 1 | Brand |
| 2 | Type |
| 1 | Type |
SELECT 3
| id | Difference |
|---|---|
| 1 | brand |
| 2 | type |
| 1 | type |
SELECT 3
| id | column_name | array_agg |
|---|---|---|
| 1 | brand | {Honda,Jeep} |
| 1 | id | {1} |
| 1 | type | {Coupe,SUV} |
| 2 | brand | {Ford} |
| 2 | id | {2} |
| 2 | type | {Crossover,Sedan} |
SELECT 6