Which constraint can be defined only at the column level?

  1. UNIQUE

  2. NOT NULL

  3. CHECK

  4. PRIMARY KEY


Correct Option: B

AI Explanation

To answer this question, you need to understand the different constraints that can be defined in a database. Let's go through each option to understand why it is correct or incorrect:

Option A) UNIQUE - This constraint can be defined at both the column level and the table level. It ensures that the values in a column are unique across all rows in the table.

Option B) NOT NULL - This constraint can only be defined at the column level. It ensures that the column cannot contain any null values.

Option C) CHECK - This constraint can be defined at both the column level and the table level. It allows you to specify a condition that must be met for the values in the column or table.

Option D) PRIMARY KEY - This constraint can be defined at both the column level and the table level. It ensures that the values in the column or combination of columns are unique and not null. It also automatically creates a unique index on the column or combination of columns.

The correct answer is B) NOT NULL. This constraint can only be defined at the column level, ensuring that the column cannot contain any null values.

Find more quizzes: