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
How to install oracle sql developer?
Can we perform dml on view?
Are pl sql variables case sensitive?
Sql technical questions
What does trigger mean in psychology?
Is sql a microsoft product?
What is before trigger?
What is sqlerrd?
What is indexing oracle sql?
how to create a table index in mysql? : Sql dba
Write the command to remove all players named sachin from the players table.
What is substitution variable in pl sql?
Explain the commit statement.
What is the use of desc in sql?
What do we need to check in database testing?