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 is the reports view in oracle sql developer?
What is the difference between sql, mysql and sql server?
What packages are available to pl/sql developers?
Why is partition used in sql?
How to assign sql query results to pl sql variables?
Can we insert data into view?
What are records give examples?
Can you have more than one trigger on a table?
What is sqlca in db2?
Who is the owner of mysql database?
Is crud a cuss word?
What does the base_object_type column shows in the user.triggers data dictionary view?
What is the difference between nvl function, ifnull function, and isnull function?
What is the difference between syntax error and runtime error?
How do I truncate a sql log file?