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

Showing Answers 1 - 56 of 56 Answers

Anil

  • 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.

SRINIVAS

  • Dec 13th, 2006
 

IN UNIQUE NULL VALUES NOT ACCEPTED

  Was this answer useful?  Yes

datageek

  • Dec 13th, 2006
 

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

  Was this answer useful?  Yes

Kamath

  • Dec 13th, 2006
 

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

Motilal

  • 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.

Thanks

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.

Tanushree

  • Dec 20th, 2006
 

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

  Was this answer useful?  Yes

Shayer

  • 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

sooraj

  • 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

ritta.singh

  • 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

neoneo

  • 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

bibhu

  • Jan 17th, 2007
 

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

  Was this answer useful?  Yes

veems26

  • 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