Bird
0
0

Given the table users with a JSON column profile containing {"name": "Alice", "age": 30}, what is the output of:

medium📝 query result Q4 of 15
PostgreSQL - JSON and JSONB
Given the table users with a JSON column profile containing {"name": "Alice", "age": 30}, what is the output of:
SELECT profile->>'name' FROM users WHERE id=1;
A"Alice"
BAlice
C30
DNULL
Step-by-Step Solution
Solution:
  1. Step 1: Understand ->> operator output

    The ->> operator extracts the JSON field value as plain text, without quotes.
  2. Step 2: Apply to given JSON

    The key 'name' has value "Alice" in JSON, so output is the text Alice without quotes.
  3. Final Answer:

    Alice -> Option B
  4. Quick Check:

    ->> returns text without quotes [OK]
Quick Trick: ->> returns plain text, no quotes included [OK]
Common Mistakes:
  • Expecting output with quotes
  • Confusing -> and ->> output types
  • Assuming numeric output for string keys

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes