Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
select from json[]
create table YourTable (folder_id int, links json[]); insert into YourTable values (761, array['{"ids": "[82293,82292]", "index": "index_1"}', '{"ids": "[82293,82292]", "index": "index_2"}']::json[]), (769, array['{"ids": "[82323,82324]", "index": "index_3"}']::json[]), (572, array['{"ids": "[80031,79674,78971]", "index": "index_4"}']::json[]), (785, array['{"ids": "[82367,82369]", "index": "index_5"}', '{"ids": "[82368,82371]", "index": "index_6"}']::json[]), (768, array['{"ids": "[82292,82306]", "index": "index_7"}', '{"ids": "[82292,82306]", "index": "index_8", "j":{"df":"ok"}}']::json[]); select * from YourTable; select distinct folder_id from YourTable cross join lateral jsonb_array_elements(to_jsonb(links)) ids(ele) where (ele->>'ids')::jsonb @> '[82293]' or (ele->>'index') = 'index_5' or (ele->>'j')::jsonb->>'df' = 'ok' ;
run
|
edit
|
history
|
help
0
xD
POSTGRESQL_CLOSEST_VALUE
univesp
SQL social network practice by Han Wang 20200720 - 2
SQL2_CLASS
Projeto
select distinct
Ultima Clase
Webiste SQL Analysis
Comp