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 are the features of pl sql?
What is synchronized subquery?
Why do we use joins in sql?
How can I see all tables in sql?
What is the use of prepared statement?
How do you optimize a stored procedure in sql?
What is not in sql?
What is composite primary key in sql?
What is before and after trigger?
How to read/write files from pl/sql?
Can delete statement be rollbacked?
what are enums used for in mysql? : Sql dba
What is the difference between cluster and non-cluster index?
What is oracle pl sql developer?
Is sql a programming?