I was suppose to get all data from the table where the column “Address” is not null
so I made a statement that look like this…
Select * from Table where Address is not null
Unfortunately, there are rows in “Address” column that has spaces so SQL cannot consider it as Null
How can I display rows where Address is not null?
Thanks 🙂
Most database systems have a NULLIF() function. It was defined together with COALESCE() in the ANSI SQL-99 standard if not earlier. It is implemented in at least SQL Server, Oracle, PostgreSQL, MySQL, SQLite, DB2, Firebird.
But for me, I like this more
It kills nulls and empty strings in one go. It will even exclude strings that are made up entirely of spaces (”, ‘ ‘, etc). It also retains SARGability.