Bird
0
0

What does the PostgreSQL JSONB existence operator ? check for?

easy📝 Conceptual Q11 of 15
PostgreSQL - JSON and JSONB

What does the PostgreSQL JSONB existence operator ? check for?

AIf a JSONB column contains any null values
BIf a JSONB column is empty
CIf a specified key or string exists at the top level in a JSONB column
DIf a JSONB column contains nested arrays
Step-by-Step Solution
Solution:
  1. Step 1: Understand the operator's purpose

    The ? operator checks for the presence of a key or string in JSONB data.
  2. Step 2: Identify the scope of the check

    It only checks the top-level keys or strings, not nested elements.
  3. Final Answer:

    If a specified key or string exists at the top level in a JSONB column -> Option C
  4. Quick Check:

    JSONB existence operator checks top-level keys [OK]
Quick Trick: Remember: '?' checks top-level keys only in JSONB [OK]
Common Mistakes:
  • Thinking it checks nested keys
  • Confusing it with null or empty checks
  • Assuming it works on JSON type (not JSONB)
  • Believing it checks values instead of keys

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes