What is the result, when NULL is compared with NULL?

Answers were Sorted based on User's Feedback



What is the result, when NULL is compared with NULL?..

Answer / pravin

It is not possible to compare two nulls with each other.
Still if we want to compare null then we have isnull
operator.

Is This Answer Correct ?    4 Yes 5 No

What is the result, when NULL is compared with NULL?..

Answer / gaurav arora

The answer-6 is quite matching with my stuff. Let me clear
it in more writting:
1. When we compare two nulls then the result
always 'false'. The main reason is the null is not a value
its neither an empty nor a empty space, so the actual
result is null which places as null.
2. When we compare a null with another which has some value
like some int value then the result is false. The actual
result is false and not null.

Consider the following examples:

--null = null is null which is false
Declare @intNull1 int
Set @intNull1 =null
Declare @intNull2 int
Set @intNull2=null
If @intNull1=@intNull2
Print 'null = null is true'
Else
Print 'null = null is false'

--Now assign some value
Set @intNull1 = 1
If @intNull1=@intNull2
Print 'null = int value is true'
Else
Print 'null = int value is false'

Thanks,
Gaurav Arora
http://stuff4mdesktop.blogspot.com/

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More SQL PLSQL Interview Questions

What is the requirement of self-join?

0 Answers  


how to extract a unit value from a date and time? : Sql dba

0 Answers  


how can we know the count/number of elements of an array? : Sql dba

0 Answers  


explain advantages of myisam over innodb? : Sql dba

0 Answers  


when is the use of update_statistics command? : Sql dba

0 Answers  






What is meant by Join? What are the different types of Joins available? Explain.

5 Answers   Cap Gemini,


Is sql pronounced sequel or sql?

0 Answers  


What is a sql statement?

0 Answers  


Can we use loop in sql?

0 Answers  


What is clustered and non-clustered indexes?

4 Answers   Microsoft,


Explain what is a field in a database and record in a database?

0 Answers  


What is trigger price?

0 Answers  


Categories