Bird
0
0

Which of the following commands correctly defines an ENUM type called priority with values 'low', 'medium', and 'high' in PostgreSQL?

easy📝 Conceptual Q2 of 15
PostgreSQL - Advanced Features
Which of the following commands correctly defines an ENUM type called priority with values 'low', 'medium', and 'high' in PostgreSQL?
ACREATE TYPE priority ENUM ('low', 'medium', 'high');
BCREATE ENUM priority ('low', 'medium', 'high');
CCREATE TYPE priority AS ENUM ('low', 'medium', 'high');
DCREATE ENUM TYPE priority AS ('low', 'medium', 'high');
Step-by-Step Solution
Solution:
  1. Step 1: Recall ENUM creation syntax

    The correct syntax is CREATE TYPE name AS ENUM (values);
  2. Step 2: Evaluate options

    Only CREATE TYPE priority AS ENUM ('low', 'medium', 'high'); matches the correct syntax exactly.
  3. Final Answer:

    CREATE TYPE priority AS ENUM ('low', 'medium', 'high'); -> Option C
  4. Quick Check:

    Syntax must include 'CREATE TYPE' and 'AS ENUM' [OK]
Quick Trick: Use CREATE TYPE ... AS ENUM syntax [OK]
Common Mistakes:
  • Using CREATE ENUM instead of CREATE TYPE
  • Omitting AS ENUM keywords
  • Incorrect keyword order

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes