Back to list

PostgreSQL JSONB Query

Lv.3197@mukitaro0 playsJan 2, 2026

PostgreSQL JSONB operators for querying nested JSON data. Used in Supabase and PostgREST.

preview.sql
SQL
1SELECT
2 id,
3 data->>'name' AS name,
4 data->'address'->>'city' AS city
5FROM
6 users
7WHERE
8 data @> '{"active": true}'
9 AND data->'tags' ? 'premium'
10ORDER BY
11 data->>'created_at' DESC
12LIMIT 10;

Custom problems are not included in rankings