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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the the update statement in sql?

566


what is clause? : Sql dba

580


how to select unique records from a table? : Sql dba

626


What is the use of sqlerrd 3?

519


Can we use threading in pl/sql?

513






Is sql a case sensitive language?

512


Does asenumerable execute the query?

594


What are the triggers associated with image items?

615


Can delete statement be rollbacked?

523


What are dml commands?

524


How do you take the union of two tables in sql?

514


What are the uses of merge?

717


what is blob? : Sql dba

560


Is it possible to Restore a Dropped Table using Rollback Command in Oracle SQL Plus ?

715


How global cursor can be declare with dynamic trigger ?

1746