Bird
0
0

In PostgreSQL, what is the primary advantage of using an ENUM type over a simple TEXT column?

easy📝 Conceptual Q1 of 15
PostgreSQL - Advanced Features
In PostgreSQL, what is the primary advantage of using an ENUM type over a simple TEXT column?
AIt allows storing multiple values in a single column.
BIt restricts the column to a predefined set of values, improving data integrity.
CIt automatically indexes the column for faster queries.
DIt enables storing JSON objects directly.
Step-by-Step Solution
Solution:
  1. Step 1: Understand ENUM purpose

    ENUM types restrict column values to a fixed set, ensuring only valid data is stored.
  2. Step 2: Compare with TEXT

    TEXT columns accept any string, so no inherent validation exists.
  3. Final Answer:

    It restricts the column to a predefined set of values, improving data integrity. -> Option B
  4. Quick Check:

    ENUM enforces allowed values [OK]
Quick Trick: ENUM limits values to predefined list [OK]
Common Mistakes:
  • Thinking ENUM stores multiple values per row
  • Assuming ENUM auto-indexes columns
  • Confusing ENUM with JSON storage

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes