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 are the commands used in sql?
what does it mean to have quoted_identifier on? What are the implications of having it off? : Sql dba
Who is the owner of mysql database?
Is sql harder than python?
What is a pl/sql block?
Does group by remove duplicates?
name 3 ways to get an accurate count of the number of records in a table? : Sql dba
Why we use stored procedure instead of query?
How does an execution block start and end in pl sql?
what is foreign key? : Sql dba
Can sql function call stored procedure?
What is embedded sql in db2?
What is cross join sql?
Can triggers stop a dml statement from executing on a table?
What is the basic form of sql query?