Bird
0
0

In PostgreSQL, what does the operator -> do when applied to a JSON column?

easy📝 Conceptual Q1 of 15
PostgreSQL - JSON and JSONB
In PostgreSQL, what does the operator -> do when applied to a JSON column?
AExtracts the JSON object field by key as text
BExtracts the JSON object field by key as JSON
CConverts JSON to text
DDeletes a key from JSON object
Step-by-Step Solution
Solution:
  1. Step 1: Understand the operator -> in PostgreSQL JSON

    The -> operator extracts a JSON object field by key and returns it as JSON type.
  2. Step 2: Compare with other operators

    The ->> operator extracts the field as text, not JSON. The other options describe unrelated operations.
  3. Final Answer:

    Extracts the JSON object field by key as JSON -> Option B
  4. Quick Check:

    -> operator = Extract JSON field as JSON [OK]
Quick Trick: Use -> for JSON output, ->> for text output [OK]
Common Mistakes:
  • Confusing -> with ->> operator
  • Thinking -> converts JSON to text
  • Assuming -> deletes keys

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes