SQLite select where empty? SQLite select where empty? sqlite sqlite

SQLite select where empty?


There are several ways, like:

where some_column is null or some_column = ''

or

where ifnull(some_column, '') = ''

or

where coalesce(some_column, '') = ''

of

where ifnull(length(some_column), 0) = 0


It looks like you can simply do:

SELECT * FROM your_table WHERE some_column IS NULL OR some_column = '';

Test case:

CREATE TABLE your_table (id int, some_column varchar(10));INSERT INTO your_table VALUES (1, NULL);INSERT INTO your_table VALUES (2, '');INSERT INTO your_table VALUES (3, 'test');INSERT INTO your_table VALUES (4, 'another test');INSERT INTO your_table VALUES (5, NULL);

Result:

SELECT id FROM your_table WHERE some_column IS NULL OR some_column = '';id        ----------1         2         5    


Maybe you mean

select xfrom some_tablewhere some_column is null or some_column = ''

but I can't tell since you didn't really ask a question.