By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE
| jsonb_pretty |
|---|
| { "empdet": { "isMgr": false, "deptno": "102", "selectedDept": { "deptno": "102", "empName": "MILLER SALESMAN" }, "selectedMgrs": [ { "id": "1", "list": [ { "mgrName": "KING", "mgrRole": "KING PRESIDENT" }, { "mgrName": "SCOTT", "mgrRole": "SCOTT MGR" } ], "minApp": "1" } ] }, "jobIds": [ 770 ], "appMgrs": [ { "mgrId": "KING", "mgrType": "U" } ], "deptLoc": "NEW YORK" } |
INSERT 0 1
| jsonb_pretty |
|---|
| { "empdet": { "isMgr": false, "deptno": "101", "selectedDept": { "deptno": "101", "empName": "SMITH SALESMAN" }, "selectedMgrs": [ { "id": "2", "list": [ { "mgrName": "KING", "mgrRole": "KING PRESIDENT" }, { "mgrName": "BLAKE", "mgrRole": "BLAKE MGR" } ], "minApp": "1" } ] }, "jobIds": [ 775 ], "appMgrs": [ { "mgrId": "KING", "mgrType": "U" } ], "deptLoc": "NEW YORK" } |
INSERT 0 1
| id | empname | deptno | id | mgrrole | mgrname | minapp | mgrid | mgrtype | deptloc | jobids |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | MILLER SALESMAN | 102 | "1" | KING PRESIDENT | KING | "1" | "KING" | "U" | NEW YORK | 770 |
| 1 | MILLER SALESMAN | 102 | "1" | SCOTT MGR | SCOTT | "1" | "KING" | "U" | NEW YORK | 770 |
| 2 | SMITH SALESMAN | 101 | "2" | KING PRESIDENT | KING | "1" | "KING" | "U" | NEW YORK | 775 |
| 2 | SMITH SALESMAN | 101 | "2" | BLAKE MGR | BLAKE | "1" | "KING" | "U" | NEW YORK | 775 |
SELECT 4
| id | empname | deptno | id | mgrrole | mgrname | minapp | mgrid | mgrtype | deptloc | jobids |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | MILLER SALESMAN | 102 | 1 | KING PRESIDENT | KING | 1 | KING | U | NEW YORK | 770 |
| 1 | MILLER SALESMAN | 102 | 1 | SCOTT MGR | SCOTT | 1 | KING | U | NEW YORK | 770 |
| 2 | SMITH SALESMAN | 101 | 2 | KING PRESIDENT | KING | 1 | KING | U | NEW YORK | 775 |
| 2 | SMITH SALESMAN | 101 | 2 | BLAKE MGR | BLAKE | 1 | KING | U | NEW YORK | 775 |
SELECT 4