Can we use more than one null value for unique key?
Answer Posted / mukesh
Ques:= Can we use more than one null value for unique key?
Ans:=Yes, we can use multiple Null values in case of Unique Key
Column.
SQL> create table abcd(name varchar2(10) unique);
Table created.
SQL> insert into abcd(name)values('amit');
1 row created.
SQL> insert into abcd(name)values('MKS');
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> insert into abcd(name)values('');
1 row created.
SQL> insert into abcd(name)values('');
1 row created.
SQL> insert into abcd(name)values('');
1 row created.
SQL> select * from abcd order by name desc;
NAME
----------
amit
MKS
8 rows selected.
Note:= Here blank space above represents the entries of null
statements..!!
SQL> select nvl(name,0) from abcd;
NVL(NAME,0
----------
amit
MKS
0
0
0
0
0
0
8 rows selected.
SQL> select nvl(name,'a') from abcd;
NVL(NAME,'
----------
amit
MKS
a
a
a
a
a
a
8 rows selected.
| Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
What does the base_object_type column shows in the user.triggers data dictionary view?
Is it possible for a table to have more than one foreign key?
What type of database is cloud sql?
What is difference between joins and union?
What is the syntax to add a record to a table?
What is substitution variable in pl sql?
Can dml statements be used in pl/sql?
what are the 'mysql' command line options? : Sql dba
How to use sql statements in pl/sql?
What is scalar function in sql?
Can pl sql procedure have a return statement?
What is the maximum rows in csv?
what are the security recommendations while using mysql? : Sql dba
What does a pl/sql package consist of?
Why do we use cursors?