Which constraint can be defined only at the column level?

  1. UNIQUE

  2. NOT NULL

  3. CHECK

  4. PRIMARY KEY

  5. FOREIGN KEY


Correct Option: B

AI Explanation

To answer this question, you need to understand the different types of constraints that can be defined in a database.

Option A) UNIQUE - This option is incorrect because the UNIQUE constraint can be defined at both the column level and the table level. It ensures that the values in a specific column or combination of columns are unique.

Option B) NOT NULL - This option is correct because the NOT NULL constraint can only be defined at the column level. It ensures that a column must have a value and cannot be left empty or null.

Option C) CHECK - This option is incorrect because the CHECK constraint can be defined at both the column level and the table level. It allows you to specify a condition that must be satisfied for the data in a column.

Option D) PRIMARY KEY - This option is incorrect because the PRIMARY KEY constraint can be defined at both the column level and the table level. It uniquely identifies each row in a table and can be defined on one or more columns.

Option E) FOREIGN KEY - This option is incorrect because the FOREIGN KEY constraint can be defined at both the column level and the table level. It establishes a relationship between two tables based on a common column.

The correct answer is B) NOT NULL. This option is correct because the NOT NULL constraint can only be defined at the column level, ensuring that the column must have a value and cannot be null.

Find more quizzes: