Bird
0
0

Which of the following is the correct syntax to name a UNIQUE constraint on the column Email in table Users?

easy📝 Syntax Q3 of 15
SQL - Table Constraints
Which of the following is the correct syntax to name a UNIQUE constraint on the column Email in table Users?
ACONSTRAINT Email_Unique (Users)
BCONSTRAINT UNIQUE_Email_Users (Email)
CCONSTRAINT UQ_Users_Email UNIQUE (Email)
DUNIQUE CONSTRAINT Email_Users
Step-by-Step Solution
Solution:
  1. Step 1: Recall the syntax for naming UNIQUE constraints

    The syntax is CONSTRAINT constraint_name UNIQUE (column_name).
  2. Step 2: Check naming convention and syntax correctness

    CONSTRAINT UQ_Users_Email UNIQUE (Email) uses the correct syntax and a clear naming convention: UQ prefix, table name, column name.
  3. Final Answer:

    CONSTRAINT UQ_Users_Email UNIQUE (Email) -> Option C
  4. Quick Check:

    Unique constraint syntax = D [OK]
Quick Trick: Use UQ prefix + table + column for unique constraints [OK]
Common Mistakes:
MISTAKES
  • Placing UNIQUE before CONSTRAINT
  • Wrong order of table and column in name
  • Using invalid syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes