Which two statements are true about constraints?

  1. The UNIQUE constraint does not permit a null value for the column.

  2. A UNIQUE index gets created for columns with PRIMARY KEY and UNIQUE constraints.

  3. The PRIMARY KEY and FOREIGN KEY constraints create a UNIQUE index.

  4. The NOT NULL constraint ensures that null values are not permitted for the column.


Correct Option: A,D

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) The UNIQUE constraint does not permit a null value for the column. This option is correct. The UNIQUE constraint ensures that each value in the column is unique. It also does not permit a null value for the column, meaning that the column must have a non-null value for each row.

Option B) A UNIQUE index gets created for columns with PRIMARY KEY and UNIQUE constraints. This option is incorrect. While it is true that a UNIQUE index is created for columns with UNIQUE constraints, it is not true for columns with PRIMARY KEY constraints. A PRIMARY KEY constraint automatically creates a unique index, but a UNIQUE constraint creates a separate unique index.

Option C) The PRIMARY KEY and FOREIGN KEY constraints create a UNIQUE index. This option is incorrect. While it is true that a PRIMARY KEY constraint automatically creates a unique index, a FOREIGN KEY constraint does not create a unique index. A FOREIGN KEY constraint is used to establish a relationship between two tables.

Option D) The NOT NULL constraint ensures that null values are not permitted for the column. This option is correct. The NOT NULL constraint ensures that the column must have a non-null value for each row. It does not allow null values to be inserted into the column.

The correct answer is A and D. These options are correct because the UNIQUE constraint does not permit a null value for the column, and the NOT NULL constraint ensures that null values are not permitted for the column.

Find more quizzes: