How many null values does a column accept if it is declared as a unique key?

Showing Answers 1 - 20 of 20 Answers


  • Dec 9th, 2006

The unique key can take any number of null value.The restriction is for the value which are not null then that value has to be unique.

If we declare that unique key to be primary then they cannot take null value.

It is therefore said that the primary key are unique key which are not null.


  • Dec 13th, 2006


  Was this answer useful?  Yes


  • Dec 13th, 2006

Null values are not accepted for keys. (nonulls)Duh!

  Was this answer useful?  Yes


  • Dec 13th, 2006

There can be only 1 null value for the Uniquekey column.


  • Dec 14th, 2006

A Unique key can take any no. of null values.

That is the difference between a unique key and a primary key.

A primary key doesnot allow a null value.

So, here also arises a question that, if a unique key can not take duplicate values, how it accepts multiple null values

The answer is, null values actually correspond to some garbage value at the backend. Which are unique from each other.


plz check it out in any good book. You cannot give wrong information to users. Unique key column can take any number of NULL values because unique key treats every null value different from each other.


  • Dec 20th, 2006

Unique key accepts any number of NULL values.I have tried it in mysql server.

  Was this answer useful?  Yes


  • Dec 20th, 2006

In SQL server 2000,if a column is declared as a unique key thenit can accept only one null value.

  Was this answer useful?  Yes

srinivasan R

  • Dec 25th, 2006

There can be only one null value in Unique key.

Both Primary and Unique are same, Primary key cannot accept null values, but unique key will accept 1 times null values.

  Was this answer useful?  Yes


  • Dec 27th, 2006

         the difference between primary key n unique key is that primary key cant accept any null values but unique key can accept one n only one null value.

  Was this answer useful?  Yes


  • Dec 30th, 2006

A Unique key column can have any number of Null Values, and this is because no 2 null values are equal.

A Null value is a value which does not exists or which exists and is not known or is not applicable in the current context.

  Was this answer useful?  Yes


  • Jan 3rd, 2007

A Unique key column can have any number of Null Values, and this is because no 2 null values are equal. and Column takes the value from Buffer cache.

  Was this answer useful?  Yes


  • Jan 17th, 2007

By default unique key columns accept null values unless not null constraint is specified.

  Was this answer useful?  Yes


  • Mar 26th, 2007

If a column has unique key constraint then, it accepts only one null value.
This is one of the difference between Primary key and Unique key.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions