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
Enlist the data types that can be used in pl/sql?
Why do we use triggers?
What does the sign mean in sql?
Which sql statement is used to return only different values?
what is unique key constraint? : Sql dba
what are all different types of collation sensitivity? : Sql dba
What are the sql commands?
What is the difference between sql and isql*plus?
Does inner join remove duplicates?
What are the advantages of stored procedure?
Is primary key a clustered index?
How do you take the union of two tables in sql?
what is myisam? : Sql dba
How do you explain an index?
Can we use threading in pl/sql?