AdvancedBasic SELECT
Querying JSONB properties
The query
SQL
SELECT
user_id,
settings->>'theme' AS theme_name,
settings#>'{notifications,email}' AS email_enabled
FROM user_preferences
WHERE settings->>'theme' = 'dark';Note
“->> returns value as text. #> gets JSON object at specified path. PostgreSQL handles NoSQL-like documents beautifully.