Can we use more than one null value for unique key?

Answers were Sorted based on User's Feedback



Can we use more than one null value for unique key?..

Answer / anil kumar abbireddy

We can insert any number of null values in the column which
contains the unique key
the reason is NULL is not equal to anothere NUll
so each null is different so there is no question of
duplication

Is This Answer Correct ?    140 Yes 30 No

Can we use more than one null value for unique key?..

Answer / rao

We can insert more than one null into table

Is This Answer Correct ?    105 Yes 36 No

Can we use more than one null value for unique key?..

Answer / talent pool

If we use more than one, it leads to
duplicate, which effects the fundamental property of unique
key.

But......
We can insert any number of null values in the column which
contains the unique key.
The reason is NULL is not equal to anothere NUll
so each null is different so there is no question of
duplication

Is This Answer Correct ?    57 Yes 16 No

Can we use more than one null value for unique key?..

Answer / slimtech

The answer to this question depends on the database that we
are using
1. In SQL Server and DB2, we can insert only one null value
in the Unique Key column.
2. In Oracle, we can insert multiple null values

Is This Answer Correct ?    31 Yes 0 No

Can we use more than one null value for unique key?..

Answer / debdut bhaumik

Yes , More than one field can be NULL in a unique Key
column. Because a Null values is not equal to another null
value. So, no duplicate value is there.

Is This Answer Correct ?    26 Yes 12 No

Can we use more than one null value for unique key?..

Answer / rajesh

yes,we can use more than one null value for unique key.
Bcz all null values are unique,
thing is that null is unknown ,unassignable,
undefind ,inapplicable value and allwase null is not equal
to null and any arithimitic operation and logical
comparision all wase result null

Is This Answer Correct ?    21 Yes 9 No

Can we use more than one null value for unique key?..

Answer / ravin

Yes we can..
Hey guys.. don't be confused with the values and nulls.
Unique key conforms only the values to be unique. Since the
nulls are not any kind of value, they can occur as many
times as they can.. nulls are nothing..

Is This Answer Correct ?    13 Yes 2 No

Can we use more than one null value for unique key?..

Answer / amit rajoria

Yes, we can use multiple Null values in case of Unique Key
Column. This is one the main difference between Unique Key
and Primary Key that Unique Key always allows multiple
entries of Null Statement where as Primary Key never allows
this.

I am hereby giving you a very very basic example which
suggests that Unique Key can have more than one Null
Statement :-

SQL> create table abcd(name varchar2(10) unique);

Table created.

**********************

Now insert the values :-

SQL> insert into abcd(name)values('amit');

1 row created.

SQL> insert into abcd(name)values('ami');

1 row created.

SQL> insert into abcd(name)values(null);

1 row created.

SQL> insert into abcd(name)values(null);

1 row created.

SQL> insert into abcd(name)values(null);

1 row created.

SQL> commit;

Commit complete.

SQL> select * from abcd;

NAME
----------
amit
ami



Here blank space above represents the entries of null
statements..!!

Is This Answer Correct ?    14 Yes 3 No

Can we use more than one null value for unique key?..

Answer / pratibha

u can insert multiple null values without ant error:

SQL> create table sab(name varchar2(10) unique);

Table created.

SQL> insert into sab values('&sab');
Enter value for sab:
old 1: insert into sab values('&sab')
new 1: insert into sab values('')

1 row created.

SQL> /
Enter value for sab:
old 1: insert into sab values('&sab')
new 1: insert into sab values('')

1 row created.

SQL> /
Enter value for sab:
old 1: insert into sab values('&sab')
new 1: insert into sab values('')

1 row created.

SQL> /
Enter value for sab:
old 1: insert into sab values('&sab')
new 1: insert into sab values('')

1 row created.

SQL> /
Enter value for sab:
old 1: insert into sab values('&sab')
new 1: insert into sab values('')

1 row created.

SQL> SQL> select count(*) from sab;

COUNT(*)
----------
5

Is This Answer Correct ?    10 Yes 0 No

Can we use more than one null value for unique key?..

Answer / kalyana chakravarthy

Fundamental principle is 2 nulls are not unique. U can
insert N number of nulls in a unique its CONCRETE

Is This Answer Correct ?    7 Yes 1 No

Post New Answer

More SQL PLSQL Interview Questions

What is cursor and why it is required?

0 Answers  


explain the delete statements in sql

0 Answers  


What is dialect in sql?

0 Answers  


How do I delete a trigger?

0 Answers  


What are crud methods?

0 Answers  






Is like operator in sql case sensitive?

0 Answers  


What is integrity constraints?

5 Answers   Ramco, Satyam,


What can sql server reporting services do?

0 Answers  


Are stored procedures compiled?

0 Answers  


When are we going to use truncate and delete?

0 Answers  


What is parameter substitution in sql?

0 Answers  


what is the difference between cluster and non cluster index? : Sql dba

0 Answers  


Categories