0

Following is my problem;

  1. I created a table using create table timepass(anyvalue bigint(19),name varchar(20)); And i inserted some null values into it.

Now the table looks like this.

"anyvalue" "name"
  Null     Rahul
  12       Satish
  Null     shubhanshu

Now when I fire the query

select * from timepass where name ='Rahul' and anyvalue=Null  ;

Or when i fire the query

select * from timepass where  anyvalue='Null';

I dont get any result.

I dont understand why this is happening someone pls explain..

Deepu Sasidharan
  • 5,193
  • 10
  • 40
  • 97
  • 1
    Null is no value. You don't check to see if the value of the column is equal to no value. Rather you check the column `IS NULL` or `IS NOT NULL` – Kickstart May 30 '14 at 11:41

1 Answers1

2

try this ,

select * from timepass where anyvalue is null;

try same thing for other one as,

select * from timepass where name ='Rahul' and anyvalue is null 

see here to know the difference between '= NULL' and 'IS NULL'

Community
  • 1
  • 1
ravikumar
  • 893
  • 1
  • 8
  • 12