clear markdown compare help best fiddles feedback dbanow.uk a leap of faith?
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 1926618 fiddles created (21840 in the last week).

CREATE TABLE shipments ( shipmentId numeric, metadata jsonb );
 hidden batch(es)


INSERT INTO shipments (metadata) VALUES('{ "stops": [ { "stopId": 1, "stopType": "Origin" }, { "stopId": 2, "stopType": "Destionation" }, { "stopId": 3, "stopType": "Transit" } ] }')
1 rows affected
 hidden batch(es)


select distinct metadata->'stops'->0->>'stopType' from shipments
?column?
Origin
 hidden batch(es)


create type allstops as ("stopId" int, "stopType" TEXT); select "stopType" from shipments, jsonb_populate_recordset(null::allstops ,metadata->'stops')
stopType
Origin
Destionation
Transit
 hidden batch(es)