Select *
From Table
Where (col is null or col = '')

Or

Select *
From Table
Where IsNull(col, '') = ''
Answer from codingbadger on Stack Overflow
๐ŸŒ
W3Schools
w3schools.com โ€บ sql โ€บ sql_null_values.asp
SQL NULL Values - IS NULL and IS NOT NULL
SELECT column_names FROM table_name ... a selection from the Customers table used in the examples: The IS NULL operator is used to test for empty values (NULL values)....
Discussions

Check the Variable is Empty or Null โ€“ SQLServerCentral Forums
Perhaps internally SQL Server treats ISNULL() like any other scalar function, so it prevents the optimiser from being really efficient and has to do more stuff separately for each row. Sure, but I still prefer a single check. Note that the code should include the comments to keep clarity on what it is doing. WHERE MyNullableCol != '' --This will avoid NULLs and empty ... More on sqlservercentral.com
๐ŸŒ sqlservercentral.com
September 9, 2014
What is a null in sql? is it the same as a empty cell?
NULL, in simplest terms, is the absence of data. Not to be confused with '', an empty string. If you are familiar with other languages, you could think of it as similar to undefined, in that the column has a type defined, but the specific cell has no data, and is more of a place holder for future data. When filtering for NULL, you will need to do things like table.col is null or table.col is not null In your Excel example, it depends on how you import the data, and what the definition of the target table is. The target table may have rules built into it to default the data for certain columns, or reject NULL values from other columns. You could have Null, an empty string, zero, weird dates.. etc. More on reddit.com
๐ŸŒ r/learnSQL
10
13
October 5, 2022
feature comparison - When to use NULL and when to use an empty string? - Database Administrators Stack Exchange
On the other side, when concatenating strings in Oracle. NULL varchars are treated as empty strings. ... When you want to express explicitly, that a value is assigned, you have to use something like ' '. And you have to worry whether trimming not empty results in NULL ยท select case when ltrim(' ') is null then 'null' else 'not null' end from dual ... Now looking at DBMS where '' is not identical to NULL (e.g. SQL... More on dba.stackexchange.com
๐ŸŒ dba.stackexchange.com
How to check for Is not Null And Is not Empty string in SQL server? - Stack Overflow
How can we check in a SQL Server WHERE condition whether the column is not null and not the empty string ('')? More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
Baeldung
baeldung.com โ€บ home โ€บ sql queries โ€บ find null or empty values in sql
Find Null or Empty Values in SQL Baeldung on SQL
August 20, 2025 - In this section, weโ€™ll show the methods specific to PostgreSQL, MySQL, and MS SQL. We can use the function NULLIF to compare and check if the column contains null or empty values: SELECT id, name FROM Department WHERE NULLIF(TRIM(code), '') ...
๐ŸŒ
Coginiti
coginiti.co โ€บ home โ€บ beginner โ€บ sql is null
What is the IS NULL Operator in SQL? - Coginiti
September 25, 2023 - A NULL value indicates that the data is missing or unknown, while a value of 0 indicates that the data is explicitly known and set to zero. If you are analyzing a stock table, the quantity of a product would be NULL when you donโ€™t have the ...
๐ŸŒ
W3Schools
w3schools.com โ€บ mysql โ€บ mysql_null_values.asp
MySQL NULL Values - IS NULL and IS NOT NULL
SELECT column_names FROM table_name ... the "Customers" table in the Northwind sample database: The IS NULL operator is used to test for empty values (NULL values)....
๐ŸŒ
DevArt
blog.devart.com โ€บ home โ€บ how to โ€บ how to handle null or empty values in sql server
How to Handle Null or Empty Values in SQL Server
December 19, 2024 - SELECT Color ,Size ,ProductLine ,Class ,Style FROM dbo.[Product.Test] WHERE (Color IS NULL OR TRIM(Color) = '') OR (Size IS NULL OR TRIM(Size) = '') OR (ProductLine IS NULL OR TRIM(ProductLine) = '') OR (Class IS NULL OR TRIM(Class) = '') OR (Style IS NULL OR TRIM(Style) = '') It helps us ensure there are no empty or meaningless values in the specified column. In addition to SQL queries, Microsoft SQL Server offers built-in functions specifically designed to handle NULL values.
๐ŸŒ
SQLServerCentral
sqlservercentral.com โ€บ forums โ€บ topic โ€บ check-the-variable-is-empty-or-null โ€บ page โ€บ 3
Check the Variable is Empty or Null โ€“ SQLServerCentral Forums
September 9, 2014 - Perhaps internally SQL Server treats ISNULL() like any other scalar function, so it prevents the optimiser from being really efficient and has to do more stuff separately for each row. Sure, but I still prefer a single check. Note that the code should include the comments to keep clarity on what it is doing. WHERE MyNullableCol != '' --This will avoid NULLs and empty ...
Find elsewhere
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ sql server โ€บ how-to-check-a-column-is-empty-or-null-in-sql-server
How to Check a Column is Empty or Null in SQL Server - GeeksforGeeks
January 31, 2024 - In this article let us discuss in detail, how to check if a column is Empty or NULL in SQL Server, with examples and different methods.
๐ŸŒ
DotFactory
dofactory.com โ€บ sql โ€บ where-isnull
SQL IS NULL | IS NOT NULL
A WHERE IS NULL clause returns rows with columns that have NULL values. WHERE IS NOT NULL returns rows with column values that are not NULL.
๐ŸŒ
W3Schools
w3schools.com โ€บ sql โ€บ sql_ref_is_null.asp
SQL IS NULL
The IS NULL command is used to test for empty values (NULL values). The following SQL lists all customers with a NULL value in the "Address" field: SELECT CustomerName, ContactName, Address FROM Customers WHERE Address IS NULL; Try it Yourself ...
๐ŸŒ
ThoughtSpot
thoughtspot.com โ€บ sql-tutorial โ€บ sql-is-null
SQL IS NULL: Find Missing or Empty Values
March 12, 2026 - This is covered in greater detail in the intermediate tutorial, but for now, here's what you need to know: You can select rows that contain no data in a given column by using IS NULL.
๐ŸŒ
Microsoft Learn
learn.microsoft.com โ€บ en-us โ€บ sql โ€บ t-sql โ€บ language-elements โ€บ null-and-unknown-transact-sql
NULL and UNKNOWN (Transact-SQL) - SQL Server | Microsoft Learn
To test for null values in a query, use IS NULL or IS NOT NULL in the WHERE clause. You can insert null values into a column by explicitly stating NULL in an INSERT or UPDATE statement, or by leaving a column out of an INSERT statement.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ how-do-i-check-if-a-column-is-empty-or-null-in-mysql
How do I check if a column is empty or null in MySQL?
SELECT * FROM yourTableName WHERE yourSpecificColumnName IS NULL OR yourSpecificColumnName = ' '; The IS NULL constraint can be used whenever the column is empty and the symbol (' ') is used when there is empty value.
Top answer
1 of 11
93

Let's say that the record comes from a form to gather name and address information. Line 2 of the address will typically be blank if the user doesn't live in apartment. An empty string in this case is perfectly valid. I tend to prefer to use NULL to mean that the value is unknown or not given.

I don't believe the physical storage difference is worth worrying about in practice. As database administrators, we have much bigger fish to fry!

2 of 11
28

I do not know about MySQL and PostgreSQL, but let me treat this a bit generally.

There is one DBMS namely Oracle which doesn't allow to choose it's users between NULL and ''. This clearly demonstrates that it is not necessary to distinguish between both. There are some annoying consequences:

You set a varchar2 to an empty string like this:

Update mytable set varchar_col = '';

the following leads to the same result

Update mytable set varchar_col = NULL;

But to select the columns where the value is empty or NULL, you have to use

select * from mytable where varchar_col is NULL;

Using

select * from mytable where varchar_col = '';

is syntactically correct, but it never returns a row.

On the other side, when concatenating strings in Oracle. NULL varchars are treated as empty strings.

select NULL || 'abc' from DUAL;

yields abc. Other DBMS would return NULL in these cases.

When you want to express explicitly, that a value is assigned, you have to use something like ' '.

And you have to worry whether trimming not empty results in NULL

select case when ltrim(' ') is null then 'null' else 'not null' end from dual

It does.

Now looking at DBMS where '' is not identical to NULL (e.g. SQL-Server)

Working with '' is generally easier and in most case there is no practical need to distinguish between both. One of the exceptions I know, is when your column represents some setting and you have not empty defaults for them. When you can distinguish between '' and NULL you are able to express that your setting is empty and avoid that the default applies.

๐ŸŒ
Quora
quora.com โ€บ What-is-the-standard-SQL-query-for-checking-null-or-empty-strings
What is the standard SQL query for checking null or empty strings? - Quora
In standard SQL, you can use the IS NULL predicate to check if a value is NULL. To check for empty strings, you can use the IS NULL predicate along with the LENGTH function (or its equivalent for your database system) to check if the length ...
๐ŸŒ
W3Schools
w3schools.com โ€บ sql โ€บ sql_isnull.asp
SQL COALESCE(), IFNULL(), ISNULL(), NVL() Functions
Note: A NULL value represents an unknown or missing data in a database field. It is not a value itself, but a placeholder to indicate the absence of data. ... The "InOrder" column is optional, and may contain NULL values.
๐ŸŒ
Programiz
programiz.com โ€บ sql โ€บ is-null-not-null
SQL IS NULL and IS NOT NULL (With Examples)
It has the following syntax: SELECT column1, column2, ... FROM table WHERE column_name IS NULL; ... Here, the above SQL query retrieves all the rows from the Employee table where the value of the email column is NULL. ... Note: Empty values are considered NULL.
๐ŸŒ
Sqltrainingonline
sqltrainingonline.com โ€บ blog โ€บ how-to-filter-for-sql-null-or-empty-string
How to Filter for SQL Null or Empty String
November 5, 2012 - You have to use a clause in SQL IS Null. On the other hand, an empty string is an actual value that can be compared to in a database.