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


Please Help Members By Posting Answers For Below Questions

Enlist the data types that can be used in pl/sql?

749


Why do we use triggers?

719


What does the sign mean in sql?

704


Which sql statement is used to return only different values?

714


what is unique key constraint? : Sql dba

748






what are all different types of collation sensitivity? : Sql dba

710


What are the sql commands?

792


What is the difference between sql and isql*plus?

704


Does inner join remove duplicates?

699


What are the advantages of stored procedure?

724


Is primary key a clustered index?

710


How do you take the union of two tables in sql?

734


what is myisam? : Sql dba

759


How do you explain an index?

988


Can we use threading in pl/sql?

712