Reputation: 147
I have to use from sqlite DB and I insert many data in my sqlite file. now I want execute records that has "NULL". in oder word I want to see records that are "NULL". when I execute this code I nothing get.
select * from table1 where ParentID = NULL
//or this select * from table1 where ParentID = 'NULL'
this is my sqlite file :
I want execute folder1 with checking ParentID (I need only check ParentID column)
Upvotes: 1
Views: 56
Reputation: 6677
You should use IS NULL
. (The comparison operators =
and <>
both give UNKNOWN with NULL on either side of the expression.)
SELECT * FROM table1 WHERE ParentID IS NULL;
Upvotes: 0
Reputation: 10171
NULL
values represent missing unknown data.By default, a table column can hold NULL values.NULL values are treated differently from other values.
SELECT * FROM table1 WHERE ParentID IS NULL
Upvotes: 2
Reputation: 181097
NULL
is never equal to anything, including NULL
. You need to use IS
instead.
SELECT * FROM table1 WHERE ParentID IS NULL
Upvotes: 6
Reputation: 6029
You have to use the following:
select * from table1 where ParentID is NULL
Upvotes: 5