Can we use more than one null value for unique key?
Answers were Sorted based on User's Feedback
Answer / anil kumar abbireddy
We can insert any number of null values in the column which
contains the unique key
the reason is NULL is not equal to anothere NUll
so each null is different so there is no question of
duplication
| Is This Answer Correct ? | 140 Yes | 30 No |
Answer / talent pool
If we use more than one, it leads to
duplicate, which effects the fundamental property of unique
key.
But......
We can insert any number of null values in the column which
contains the unique key.
The reason is NULL is not equal to anothere NUll
so each null is different so there is no question of
duplication
| Is This Answer Correct ? | 57 Yes | 16 No |
Answer / slimtech
The answer to this question depends on the database that we
are using
1. In SQL Server and DB2, we can insert only one null value
in the Unique Key column.
2. In Oracle, we can insert multiple null values
| Is This Answer Correct ? | 31 Yes | 0 No |
Answer / debdut bhaumik
Yes , More than one field can be NULL in a unique Key
column. Because a Null values is not equal to another null
value. So, no duplicate value is there.
| Is This Answer Correct ? | 26 Yes | 12 No |
Answer / rajesh
yes,we can use more than one null value for unique key.
Bcz all null values are unique,
thing is that null is unknown ,unassignable,
undefind ,inapplicable value and allwase null is not equal
to null and any arithimitic operation and logical
comparision all wase result null
| Is This Answer Correct ? | 21 Yes | 9 No |
Answer / ravin
Yes we can..
Hey guys.. don't be confused with the values and nulls.
Unique key conforms only the values to be unique. Since the
nulls are not any kind of value, they can occur as many
times as they can.. nulls are nothing..
| Is This Answer Correct ? | 13 Yes | 2 No |
Answer / amit rajoria
Yes, we can use multiple Null values in case of Unique Key
Column. This is one the main difference between Unique Key
and Primary Key that Unique Key always allows multiple
entries of Null Statement where as Primary Key never allows
this.
I am hereby giving you a very very basic example which
suggests that Unique Key can have more than one Null
Statement :-
SQL> create table abcd(name varchar2(10) unique);
Table created.
**********************
Now insert the values :-
SQL> insert into abcd(name)values('amit');
1 row created.
SQL> insert into abcd(name)values('ami');
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> commit;
Commit complete.
SQL> select * from abcd;
NAME
----------
amit
ami
Here blank space above represents the entries of null
statements..!!
| Is This Answer Correct ? | 14 Yes | 3 No |
Answer / pratibha
u can insert multiple null values without ant error:
SQL> create table sab(name varchar2(10) unique);
Table created.
SQL> insert into sab values('&sab');
Enter value for sab:
old 1: insert into sab values('&sab')
new 1: insert into sab values('')
1 row created.
SQL> /
Enter value for sab:
old 1: insert into sab values('&sab')
new 1: insert into sab values('')
1 row created.
SQL> /
Enter value for sab:
old 1: insert into sab values('&sab')
new 1: insert into sab values('')
1 row created.
SQL> /
Enter value for sab:
old 1: insert into sab values('&sab')
new 1: insert into sab values('')
1 row created.
SQL> /
Enter value for sab:
old 1: insert into sab values('&sab')
new 1: insert into sab values('')
1 row created.
SQL> SQL> select count(*) from sab;
COUNT(*)
----------
5
| Is This Answer Correct ? | 10 Yes | 0 No |
Answer / kalyana chakravarthy
Fundamental principle is 2 nulls are not unique. U can
insert N number of nulls in a unique its CONCRETE
| Is This Answer Correct ? | 7 Yes | 1 No |
what is a stored procedure? : Sql dba
What is a bitmap index?
4 Answers Choice Solutions, Infosys,
How do you clear the screen in sql?
How do I find duplicates in the same column?
How do I view a view in sql?
How do I order columns in sql?
What are wait events. Describe the wait event tables.
Explain the two type of Cursors ?
how to delete duplicate rows from a join tables(I have three tables on that join) how do you know which join is need to be used? The select statement I have is: SELECT gc_skill_type.skill_type, gc_area_tec.area, gc_technology.technology, gc_technology.id_technology, gc_area_tec.id_area_tec FROM gc_skill_type, gc_area_tec, gc_technology WHERE gc_area_tec.id_skill_type (+) = gc_skill_type.id_skill_type AND gc_technology.id_area_tec (+) = gc_area_tec.id_area_tec order by gc_skill_type.skill_type asc, gc_area_tec.area asc, gc_technology.technology asc
Is pl sql and postgresql same?
What is error ora-01000: maximum open cursors exceeded
Table1: Col1 col2 1 2 10 3 4 89 5 6 Table:2 Col1 col2 3 2 9 5 4 7 6 87 With the help of table1 and table2 write a query to simulate the fallowing results. Output1: Col1 col2 1 2 2 3 3 4 4 5 5 6 Output2: Col1 col2 2 3 10 4 5 89 6 7 1.Write query for single row to multiple row using sql statements. Eg:a,b,c,d,e,f Change to A B C D E F 2. Write query for multiple row to single row using sql statements. Eg2 A B C D E F Change to Eg:a,b,c,d,e,f Table1: Col1 col2 8 5 2 9 4 2 5 1.Write a query to select all the rows from a table1,if the value of A is null then corresponding B’s value should be printed in A’s value.if the value of A is null in that table then corresponding B’s value should be printed as 30. 2. write a query to find the sum of A and B .display the max among both. 3.write a query to find total number of rows from table 1. Note: if any column value is null in a row then that row should be considered as 2 rows. 4.write a query to display all the records of table1 except A containg 2 as well B containg 5. 5.rewrite the fallowing without using join and group by. Select b.title,max(bc.returneddate –bc.checkoutdate)” mostdaysout” From bookshelf_checkout bc, Book shelf B Where bc.title(+)=b.title Group by b.title. 6.rewrite fallowing query Select id_category from category_master X where exists (select 1 from sub_category Y where X.id_category=Y.id_category) Customer: Name phone1 phone2 phone3 bitwise A 23456 67890 12345 --- B 67459 89760 37689 --- Don’t_call Col1 67890 37689 1.q) update the customer table of bitwise with 1 or 0. Exists in don’t_call table menas show -1 Other wise -0. Output. Name bitwise A 010 B 010
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)