Bird
0
0

What is wrong with this query?

medium📝 Debug Q14 of 15
PostgreSQL - JSON and JSONB
What is wrong with this query?
SELECT data->>details->>'color' FROM items;
AMissing quotes around 'details' key
BUsing ->> before -> causes syntax error
CCannot chain arrow operators
DNo JSON column named 'data'
Step-by-Step Solution
Solution:
  1. Step 1: Check key quoting in arrow operators

    Keys must be in single quotes. Here, 'details' is unquoted, causing error.
  2. Step 2: Confirm chaining is allowed

    Chaining -> and ->> is valid if keys are quoted properly.
  3. Final Answer:

    Missing quotes around 'details' key -> Option A
  4. Quick Check:

    Always quote keys in arrow operators [OK]
Quick Trick: Always put keys in single quotes when using -> or ->> [OK]
Common Mistakes:
  • Forgetting quotes around JSON keys
  • Assuming ->> can be used before -> without quotes
  • Thinking chaining arrow operators is invalid

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes