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
What is sap sql anywhere?
Is coalesce faster than isnull?
What is the best partition size for windows 10?
Explain what is a view?
Why is theta join required?
How do I restart sql?
What is sql exception?
Which sql most popular?
How many types of relationship are there?
what are the limitations of mysql in comparison of oracle? Mysql vs. Oracle. : Sql dba
Is sql a backend language?
What is forward declaration in pl sql?
what is a composite primary key ? : Sql dba
how can we know the count/number of elements of an array? : Sql dba
How to create an array in pl/sql?