0PricingLogin
SQL Academy · Lesson

Path Operators: -> ->> @>

Navigate JSONB documents with ->, ->>, #>>, and check containment with @> and the jsonb_path_query family.

Three Operator Families

JSONB path operators come in three flavours:

  • -> and ->> — extract by key or index
  • #> and #>> — extract by path
  • @> and ? — test containment / key existence

-> Returns JSONB

Extract a value, keep it as JSONB:

SELECT data->'user_id' FROM events;
-- returns JSONB like  42

SELECT data->0 FROM events;
-- first element of a JSONB array

All lessons in this course

  1. JSONB vs JSON: When to Use Each
  2. Path Operators: -> ->> @>
  3. Indexing JSONB with GIN
  4. Modelling: When JSONB Beats Normalisation
← Back to SQL Academy