22 Votes

SQLite: Check or search for empty values

Question by Guest | Last update on 2021-07-06 | Created on 2015-04-24

I would like to build a little SQLite query for catching all data sets containing an empty value in a specific column from my database.

How to do that in SQLite?

ReplyPositiveNegative
1Best Answer5 Votes

Depending on the format of your column, the value of an empty column might be NULL or an empty string.

You can filter for both using the following query ("tab" is your table, "col" the column to be searched in):

SELECT id FROM tab 
WHERE (col IS NULL) OR (col = '')

With "IS NULL" you ask whether the value of the column is NULL, with "=''" you ask whether the value is containing an empty string.

For example, if the column is containing a date, you should check for NULL, if the column is containing a text, you should check for an empty string, but of course, you can also just search for both.
Last update on 2021-07-06 | Created on 2015-04-26

ReplyPositive Negative
Reply

Related Topics

The Askingbox Search

Info | 0 Comments

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own article on askingbox.com. That’s how it’s done.