Bird
0
0

How can you combine JSON support with relational data to store user profiles that have both fixed and flexible attributes?

hard📝 Application Q9 of 15
PostgreSQL - JSON and JSONB
How can you combine JSON support with relational data to store user profiles that have both fixed and flexible attributes?
AUse relational columns for fixed attributes and a JSONB column for flexible attributes.
BStore all data as JSON and ignore relational columns.
CUse only relational columns with NULLs for missing flexible data.
DStore flexible data in separate text columns.
Step-by-Step Solution
Solution:
  1. Step 1: Understand data types

    Fixed attributes fit well in relational columns; flexible data fits JSONB.
  2. Step 2: Combine both for best design

    Using relational columns plus JSONB column allows structured queries and flexibility.
  3. Final Answer:

    Use relational columns for fixed attributes and a JSONB column for flexible attributes. -> Option A
  4. Quick Check:

    Combine relational + JSONB for mixed data needs [OK]
Quick Trick: Mix relational columns with JSONB for flexible profiles [OK]
Common Mistakes:
  • Storing all data as JSON loses relational benefits
  • Using NULLs wastes space and complicates queries
  • Using text columns for flexible JSON data

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes