Which statement best describes a unique constraint in terms of nullability?

Prepare for the TJR Bootcamp Test with targeted questions and detailed explanations. Use mock exams to enhance understanding and boost your confidence. Gear up for success!

Multiple Choice

Which statement best describes a unique constraint in terms of nullability?

Explanation:
A unique constraint ensures that the values in a column (or a set of columns) are distinct. How it treats nulls isn’t fixed across all systems: in many databases, NULL is not considered equal to anything, including another NULL, so you can have multiple rows with NULL in that column while still enforcing uniqueness for all non-null values. If you truly want to forbid NULLs, you’d add a NOT NULL constraint (or use a primary key, which implies NOT NULL). This is why the statement that best describes it is that a unique constraint enforces uniqueness and can allow null values depending on the database.

A unique constraint ensures that the values in a column (or a set of columns) are distinct. How it treats nulls isn’t fixed across all systems: in many databases, NULL is not considered equal to anything, including another NULL, so you can have multiple rows with NULL in that column while still enforcing uniqueness for all non-null values. If you truly want to forbid NULLs, you’d add a NOT NULL constraint (or use a primary key, which implies NOT NULL). This is why the statement that best describes it is that a unique constraint enforces uniqueness and can allow null values depending on the database.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy