By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
DROP TABLE
CREATE TABLE
INSERT 0 1
DROP TABLE
CREATE TABLE
INSERT 0 1
DROP TABLE
CREATE TABLE
INSERT 0 1
DROP TABLE
CREATE TABLE
INSERT 0 4
| class_id | order_id | family_id | species_id |
|---|---|---|---|
| 1 | 1 | 1 | 1 |
| 1 | 1 | 1 | 2 |
| 1 | 1 | 1 | 3 |
| 1 | 1 | 1 | 4 |
SELECT 4
| jsonb_pretty |
|---|
| [ { "id": 1, "class": "Class A", "orders": [ { "id": 1, "order": "Order 1", "families": [ { "id": 1, "family": "Family 1", "species": [ { "id": 1, "species": "Species 1" }, { "id": 2, "species": "Species 2" }, { "id": 3, "species": "Species 3" }, { "id": 4, "species": "Species 4" } ] } ] } ] } ] |
SELECT 1