0
0
PostgreSQLquery~10 mins

Arrow operators (-> and ->>) in PostgreSQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to extract the JSON object field using the arrow operator.

PostgreSQL
SELECT data[1]'name' FROM users;
Drag options to blanks, or click blank then click option'
A->
B#>>
C#>
D->>
Attempts:
3 left
💡 Hint
Common Mistakes
Using ->> instead of -> returns text, not JSON.
Using #> or #>> which are for JSON path extraction.
2fill in blank
medium

Complete the code to extract the text value of the JSON field using the arrow operator.

PostgreSQL
SELECT data[1]'age' FROM users;
Drag options to blanks, or click blank then click option'
A->>
B->
C#>
D#>>
Attempts:
3 left
💡 Hint
Common Mistakes
Using -> instead of ->> returns JSON, not text.
Using #> or #>> which require JSON path arrays.
3fill in blank
hard

Fix the error in the code to correctly extract the text value from a nested JSON object.

PostgreSQL
SELECT data->'address'[1]'city' FROM users;
Drag options to blanks, or click blank then click option'
A->
B->>
C#>
D#>>
Attempts:
3 left
💡 Hint
Common Mistakes
Using ->> for both extractions causes errors.
Using #> or #>> without proper JSON path array.
4fill in blank
hard

Complete the code to extract the text value of a nested JSON field using arrow operators.

PostgreSQL
SELECT data->'profile'[1]'email' FROM users;
Drag options to blanks, or click blank then click option'
A->
B->>
C#>
D#>>
Attempts:
3 left
💡 Hint
Common Mistakes
Using ->> for both blanks causes errors.
Using #> or #>> without JSON path arrays.
5fill in blank
hard

Complete the code to extract the text value of a deeply nested JSON field using arrow operators.

PostgreSQL
SELECT data->'settings'->'notifications'[1]'email' FROM users;
Drag options to blanks, or click blank then click option'
A->
B->>
C#>
D#>>
Attempts:
3 left
💡 Hint
Common Mistakes
Using ->> too early causes errors.
Using #> or #>> without JSON path arrays.