By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE
CREATE TABLE
CREATE TABLE
INSERT 0 3
INSERT 0 4
INSERT 0 7
| id | name | jsonb_agg | jsonb_agg |
|---|---|---|---|
| 1 | HP | ["John", "John", "John", "Elton", "Elton", "Elton", "David", "David", "David"] | ["mouse", "keyboard", "mouse", "mouse", "keyboard", "mouse", "mouse", "keyboard", "mouse"] |
| 2 | Toshiba | ["Ali", "Ali", "Ali"] | ["monitor", "printer", "mouse"] |
SELECT 2
| id | users | accessories |
|---|---|---|
| 1 | ["John", "Elton", "David"] | ["mouse", "keyboard", "mouse"] |
| 2 | ["Ali"] | ["mouse", "printer", "monitor"] |
SELECT 2
| id | users | accessories |
|---|---|---|
| 1 | ["John", "Elton", "David"] | ["mouse", "keyboard", "mouse"] |
| 2 | ["Ali"] | ["mouse", "printer", "monitor"] |
SELECT 2