Bird
0
0

You want to name a check constraint on the Employees table that ensures salary is positive. Which of these names follows best practice for constraint naming conventions?

hard📝 Application Q15 of 15
SQL - Table Constraints
You want to name a check constraint on the Employees table that ensures salary is positive. Which of these names follows best practice for constraint naming conventions?
ASalaryPositiveCheck
BCheckSalaryPositive
CEmployeesCKSalary
DCK_Employees_SalaryPositive
Step-by-Step Solution
Solution:
  1. Step 1: Identify the prefix for check constraints

    Check constraints use the prefix CK_.
  2. Step 2: Combine prefix with table name and descriptive suffix

    Best practice is prefix + table name + description, so CK_Employees_SalaryPositive is clear and consistent.
  3. Final Answer:

    CK_Employees_SalaryPositive -> Option D
  4. Quick Check:

    Check prefix = CK_ plus table name [OK]
Quick Trick: Use CK_ + table name + description for check constraints [OK]
Common Mistakes:
MISTAKES
  • Using no prefix or wrong prefix
  • Not including table name
  • Using unclear or inconsistent names

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes