Bird
0
0

Which of the following is the correct syntax to extract the text value of the key 'name' from a JSON column data using the #>> operator?

easy📝 Syntax Q12 of 15
PostgreSQL - JSON and JSONB
Which of the following is the correct syntax to extract the text value of the key 'name' from a JSON column data using the #>> operator?
ASELECT data->'name' FROM table;
BSELECT data #>> '{name}' FROM table;
CSELECT data->>'name' FROM table;
DSELECT data #> '{name}' FROM table;
Step-by-Step Solution
Solution:
  1. Step 1: Understand #>> syntax

    The #>> operator requires a text array path inside curly braces, e.g., '{name}', to extract text.
  2. Step 2: Compare with other operators

    ->> extracts text but uses a different syntax without braces; #> extracts JSON, not text.
  3. Final Answer:

    SELECT data #>> '{name}' FROM table; -> Option B
  4. Quick Check:

    Correct syntax for #>> uses braces and returns text [OK]
Quick Trick: Use braces '{}' with #>> for text extraction [OK]
Common Mistakes:
  • Using #> instead of #>> for text extraction
  • Omitting braces around path
  • Confusing ->> with #>> syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes